Computer Hope

Software => Computer programming => Topic started by: yuva_17raj on May 24, 2008, 12:33:47 AM

Title: batch file for clearing a folder in c drive
Post by: yuva_17raj on May 24, 2008, 12:33:47 AM
hi i am using tomcat to run my application so that more than one client access my application and when the client logged in to my application each time 4 log files created in the following folder C:\Program Files\Apache Software Foundation\Tomcat 5.5\logs so that my application runs very slow and here i need to clear the particular folder or move the files from the folder to D:/templogs so that i need a batch program to do the specified process kindly reply me with the solution
regards
yuvaraj
Title: Re: batch file for clearing a folder in c drive
Post by: Carbon Dudeoxide on May 24, 2008, 12:56:48 AM
Have a look at the Move command

It would be something like this:

move "C:\Program Files\Apache Software Foundation\Tomcat 5.5\logs\file.log" "D:\Templogs\file.log"
Title: Re: batch file for clearing a folder in c drive
Post by: yuva_17raj on May 24, 2008, 01:30:47 AM
yes i got it
thanks and regards
yuvaraj
Title: Re: batch file for clearing a folder in c drive
Post by: Carbon Dudeoxide on May 24, 2008, 01:33:08 AM
 ;)
Title: Re: batch file for clearing a folder in c drive
Post by: yuva_17raj on May 26, 2008, 01:20:04 AM
hi as i have specified that my application is running under Tomcat as a server in online so here i should not stop the tomcat to move the file but my process has to continue i have used the simple code as follows

move /y "C:\Program Files\Apache Software Foundation\Tomcat 5.5\logs\*.*" "D:\test" so here i have the problem that my tomcat will always running but i should move the files without stopping the tomcat how to achive this using batch programs
regards
yuvaraj
Title: Re: batch file for clearing a folder in c drive
Post by: Carbon Dudeoxide on May 26, 2008, 03:02:53 AM
So if I understand this correctly, you want to back up the logs in D:\test but you can't move them because the program is in use.

Try the copy command:

Code: [Select]
copy "C:\Program Files\Apache Software Foundation\Tomcat 5.5\logs\*.*" "D:\test"