I’ve done something similiar. Here is a snippit of code (C shell) that I use at work. Fortunately, I have a copy at home (that I can share).
In my scheme, LOGS is a collection of log files (that is sorted). I notice that you follow your directory with a “/” (separator). I don’t know if that accounts for your script not working.
Just be aware of the risks of writing straight to your home directory in case somebody wants to send you a new .rhosts file or something similar[/QUOTE]
Cheers TFW.
This was just a test TBH. The actual backup line would be
cp `find /home/chris/Documents/ -mtime -1 -type f -print` "/media/Portable HD"
to write only the changed document files to the portable hard drive.
I tried the -exec command but obviously got it wrong.
Basically I only want the files from My Documents to be transferred to the external drive. I also want the file structure preserved.
Using the above line, I get the errors because some of the folders under My Documents are My Music etc and it doesn’t like the gaps and it doesn’t preserve the file structure.
Am I just going to have to use tar command because as far I can see, tar doesn’t care less about the spaces and it preserves the structure.
You would have to use awk or similar to modify the output from the find command to do this I believe. Unfortunately can’t help you 'cos I’m useless at awk.
If you just want a mirror of the directory each night without copying everything why not use rsync?
Rsync is quality I use it for cross-network nightly server backups here and its a beautiful tool. Useless *nix fact - it was written by the same bloke responsible for Samba, so his credentials are beyond dispute.
Yeah it seemed to work for the files in the directory that didn’t have spaces in. I wouldn’t have spaces in but I’m still got part of it from Windows which adds My Music and My Pcitures by default.