|
Question : Need batch to move files older than 8 days
|
|
I would like to use a batch file run as a scheduled task each night on a WinXP SP2 machine that moves all files from a permanent source location to a permanent destination location for files that are 8 days and older. I've tried to edit some of the posted solutions found here, but have not been able to get any to work. Your assistance would be greatly appreciated. Thanks!!!
|
|
Answer : Need batch to move files older than 8 days
|
|
N=Now Set objFSO = CreateObject("Scripting.FileSystemObject") strFolder="c:\source_dir" strNewDest = "c:\new_dest" Set objFolder = objFSO.GetFolder(strFolder) For Each strFiles In objFolder.Files If DateDiff("d",N, strFiles.DateLastModified) >8 Then 'objFSO.MoveFile strFiles , strNewDest & "\" & strFiles.Name Wscript.Echo strFiles.Name End If Next
do an echo first to see whether the file is really more than 8 days old, before using MoveFile.
|
|
|