Monday, November 9, 2009

Tidy up your drives

Delete any files that are older than 30 days

forfiles /p [DriveLetter]:\ /s /m *.* /d -31 /c "cmd /c del [destionation path"For example:
forfiles /p "C:\Users\julie.qiu\Desktop\dde\Flash Professional" /s /m *.* /d -0 /c "cmd /c echo y|del @file"
pause
The example above has auto answer yes

View the files

forfiles /p C:\Users\julie.qiu\Desktop\dde /s /m *.* /d -0 /c "cmd /c echo @file"

pause


Copy from one place to another
forfiles /p [DriveLetter]:\ /s /m *.* /d -31 /c "cmd /c xcopy [source] [destionation] /s /e /h /y"
For example
forfiles /p S:\ /s /m *.* /d -31 /c "cmd /c xcopy \\ecb-vfile-01\Shared O:\ /s /e /h /y"

pause

You can read more from here:
http://technet.microsoft.com/en-us/library/cc753551(WS.10).aspx

No comments:

Post a Comment