Back up script (find, cp, md5sum, rm)
Hey all
I'm just trying to make a simple back up script. I want to move all files and directories that are 1 month old out to back up into a separate folder. There will be a lot of files and I want to make sure it copies properly. The problem I'm having is integrating a MD5SUM into it to check integrity. MD5SUM is not recursive, so I figured it would work in a loop when it copies each individual file, I'll do a md5sum on each file and delete that md5 once its verified it copied ok. I'm pretty bad with the syntax, but I think this is what I want to do. Code:
#!/bin/sh Inputs? Thanks. |
I call this script genmd5sum, it makes an md5sum of all files down from the current directory + subdirectories:
Code:
#!/bin/sh |
Why don't you use md5deep -r?
|
Quote:
I don't think your find command will execute, and secondly, even if it did, you redirect all output into either a pipe or a file. In doing so, there will never be anything the for loop will store in $i. My suggestion: Write a script that handles one file as an argument from the command line--which you almost have already inside the body of the for loop. Save the script, make it executable, and then issue a command like so: Code:
$ find ~/Downloads -mtime +31 -exec yourscriptname {} \; |
All times are GMT -5. The time now is 12:11 AM. |