Question : Move subfolders and their contents to another location based on date.

Hey folks, I have a folder titled C:\Logs.  In the Logs folder there are numerous subfolders with child folders and data.  What I was hoping someone could help me with is a batch file or script that can look at the C:\logs folder and move any subfolders with their contents to another folder (C:\OldLogs for example) based on date.  For example, look at the C:\logs folder and any folder in that directory older than 30 days should be moved to c:\OldLogs.  Thanks folks, any help is greatly appreciated.

FYI, a batch file would be preferable because this may be also used in a Windows 7 pre-execution boot environment.  Don't ask why, I'm not happy about it either.

Answer : Move subfolders and their contents to another location based on date.

You can use Robocopy to accomplish this.  Robocopy is included with Windows Vista, 7, and Server 2008 and it is available in the Windows resource kit for any prior versions of Windows.  Robocopy has many options, but one that may work for you is: /MINAGE:n : MINimum file AGE - exclude files newer than n days/date.

For example:

ROBOCOPY [source_folder] [destination_folder] *.* /E /MOVE /MINAGE:30

This will move all files and subfolders older than 30 days from the source path to the destination path.

Here is a link to all of the Robocopy parameters: http://ss64.com/nt/robocopy.html
Random Solutions  
 
programming4us programming4us