I need to write a powershell script that checks a specific network location for file and subfolders that are over x days old. Then moves those older files to a different network location and verifies the integrity of the moved files before deleting them from the original location. I am confident with the move, just the checking for integrity I am confused about
Asked
Active
Viewed 521 times
1
-
4If you want check integrity then you should go for MD5 checksum. Check this link on how to get the checksum http://stackoverflow.com/questions/10521061/how-to-get-a-md5-checksum-in-powershell – Raghuram Jul 19 '13 at 05:28
-
You could use good old `xcopy` called from powershell, can do aged based copying and verification and should exist on all windows machines - http://ss64.com/nt/xcopy.html – Graham Gold Jul 19 '13 at 06:23
-
3I'd use `robocopy` rather than `xcopy`. Far more robust and versatile. – Ansgar Wiechers Jul 19 '13 at 08:16
-
I like the solutions presented above, but I want to combine some of those together in this basic algorithm: – david_jr Jul 19 '13 at 20:27
-
Recursively traverse a network location ($movePath) for all files $_.LastWriteTime >= x days | forEach { xcopy or robocopy $FileName = $_.FullName.Replace($movePath, $newPath), if (the files where written correctly) { (delete) Remove-Item $Filename from $movePath } can i combine the xcopy /v (verify) with robocopy? – david_jr Jul 19 '13 at 20:34