Search

My notebook

Category

Script

Windows – move \ copy files

Move all files older than x days

robocopy "source" "destination" /move /minage:10

Copy files was created from date:

xcopy "source\*.txt" "destination" /D:01-01-2015
Advertisements

Backup files. CMD

Compress files with WINRAR or 7ZIP.

WINRAR

rar m DESTINATIONarc_%date%.rar SOURCE*.*

7ZIP

"c:\Program Files\7-Zip"\7z a -tzip -ssw -mx7 
"Backup\%DATE:~7,2%.%DATE:~4,2%.%DATE:~-4%_FILENAME.zip" 
"Source\*.*"
With password:
"c:\Program Files\7-Zip"\7z a -tzip -ssw -mx7 -p123456 
"D:\Destination\filename_%DATE:/=.%%TIME::=.%.zip" 
"C:\Source\*"

Delete old backups after 10 days:

forfiles /p "Backup_Folder" /s /m *.zip /c "cmd /c Del @path" /d -10

 

Blog at WordPress.com.

Up ↑