T O P I C R E V I E W |
StephenD |
Posted - 10 September 2011 : 23:17:17 I'm trying to find a script in a batchfile that will move log files from one folder to another.
My files are in the named format 20110801.txt, 20110802.txt etc
I want to only move files older than 12 months and I can't use datecreated as all the files were moved to a new server and have the same datecreated/modified stamp from the migration process.
I have to use the date stamp in the file name as my trigger.
Any ideas? |
3 L A T E S T R E P L I E S (Newest First) |
HuwR |
Posted - 12 September 2011 : 08:24:32 you shouldn't need to convert them to datetime, if they are of the form yyyymmdd then you can just compare them as strings since
"20100101" < "20110101" is true for a string or a date  |
Shaggy |
Posted - 12 September 2011 : 07:56:35 The way I'd do it in ASP would be to use the FSO to loop through all the files, convert each file name to date format, use datediff to compare that date to today's date and move the file if datediff is more than 12 months. Don't know much about batch files but the process, at least, should be the same.
|
pierretopping |
Posted - 11 September 2011 : 16:02:23 Hi,
I use robocopy(google it, its free) for that exact job. You can place a min date parameter to set what age files you want. PM me if you want a copy of the batch file.
Or maybe just use wildcards in the file name for now?
Pierre |