I
think I have it figured out, but I'm still seeing some strangeness.
The final command I've come up with looks like this:
Code:
rsync -Rav $OtherOptions `find /home/ -type f -ctime 7 -print0 | xargs -0` /path/to/home_BCK
Where $OtherOptions are things like --exclude-from=file, --delete-excluded, and --delete.
It seems to be working correctly. It copies recursively and it seems to be copying ALL the directories, but it only populates those directories with files that have been modified in the last 7 days, which is exactly the behavior I want.
the -print0 | xargs -0 part of the command is meant to handle filenames with spaces in them and it took me an hour and a half of reading to figure that bit of it out.
I'm still seeing some strange behavior though. Even though the command seems to be behaving, for the most part, I'm seeing errors that look like this:
Code:
rsync: -: unknown option
rsync error: syntax or usage error (code 1) at main.c(1425) [client=3.0.7]
rsync: -: unknown option
rsync error: syntax or usage error (code 1) at main.c(1425) [client=3.0.7]
sending incremental file list
rsync: link_stat "/home/indubitableness/.wine/wineprefixes/Psychonauts/drive_c/Program" failed: No such file or directory (2)
rsync: link_stat "/root/Files/Double" failed: No such file or directory (2)
rsync: link_stat "/root/Fine" failed: No such file or directory (2)
rsync: link_stat "/root/Productions/Psychonauts/Profiles/Profile" failed: No such file or directory (2)
rsync: link_stat "/root/1/SavedGame2" failed: No such file or directory (2)
rsync: link_stat "/home/indubitableness/.wine/wineprefixes/Psychonauts/drive_c/Program" failed: No such file or directory (2)
rsync: link_stat "/root/Files/Double" failed: No such file or directory (2)
rsync: link_stat "/root/Fine" failed: No such file or directory (2)
rsync: link_stat "/root/Productions/Psychonauts/Profiles/Profile" failed: No such file or directory (2)
rsync: link_stat "/root/1/Profile" failed: No such file or directory (2)
rsync: link_stat "/root/1-" failed: No such file or directory (2)
rsync: link_stat "/root/Raz.ini" failed: No such file or directory (2)
rsync: link_stat "/home/indubitableness/.wine/wineprefixes/Psychonauts/drive_c/Program" failed: No such file or directory (2)
rsync: link_stat "/root/Files/Double" failed: No such file or directory (2)
rsync: link_stat "/root/Fine" failed: No such file or directory (2)
rsync: link_stat "/root/Productions/Psychonauts/Profiles/Profile" failed: No such file or directory (2)
rsync: link_stat "/root/1/SavedGame3" failed: No such file or directory (2)
rsync: link_stat "/home/indubitableness/.wine/wineprefixes/Psychonauts/drive_c/Program" failed: No such file or directory (2)
rsync: link_stat "/root/Files/Double" failed: No such file or directory (2)
rsync: link_stat "/root/Fine" failed: No such file or directory (2)
rsync: link_stat "/root/Productions/Psychonauts/Profiles/Profile" failed: No such file or directory (2)
rsync: link_stat "/root/1/SavedGame1" failed: No such file or directory (2)
rsync: link_stat "/home/indubitableness/.wine/wineprefixes/Psychonauts/drive_c/Program" failed: No such file or directory (2)
rsync: link_stat "/root/Files/Double" failed: No such file or directory (2)
rsync: link_stat "/root/Fine" failed: No such file or directory (2)
rsync: link_stat "/root/Productions/Psychonauts/Profiles/Profile" failed: No such file or directory (2)
rsync: link_stat "/root/1/SavedGame0" failed: No such file or directory (2)
rsync: link_stat "/home/indubitableness/.wine/wineprefixes/Psychonauts/drive_c/Program" failed: No such file or directory (2)
rsync: link_stat "/root/Files/Double" failed: No such file or directory (2)
rsync: link_stat "/root/Fine" failed: No such file or directory (2)
rsync: link_stat "/root/Productions/Psychonauts/Profiles/Profile" failed: No such file or directory (2)
rsync: link_stat "/root/1/Profile" failed: No such file or directory (2)
rsync: link_stat "/root/1-" failed: No such file or directory (2)
rsync: link_stat "/root/Raz" failed: No such file or directory (2)
rsync: link_stat "/home/indubitableness/.wine/wineprefixes/Psychonauts/drive_c/Program" failed: No such file or directory (2)
rsync: link_stat "/root/Files/Double" failed: No such file or directory (2)
rsync: link_stat "/root/Fine" failed: No such file or directory (2)
rsync: link_stat "/root/Productions/Psychonauts/AudioSettings.ini" failed: No such file or directory (2)
rsync: link_stat "/home/indubitableness/Torrent/[isoHunt]" failed: No such file or directory (2)
rsync: link_stat "/root/The" failed: No such file or directory (2)
rsync: link_stat "/root/Metal" failed: No such file or directory (2)
rsync: link_stat "/root/Gear" failed: No such file or directory (2)
rsync: link_stat "/root/Solid" failed: No such file or directory (2)
rsync: link_stat "/root/PSX" failed: No such file or directory (2)
rsync: link_stat "/root/Collection" failed: No such file or directory (2)
rsync: link_stat "/root/(NTSC-US).torrent" failed: No such file or directory (2)
rsync: link_stat "/home/indubitableness/.cache/vlc/art/artistalbum/Cake/Prolonging" failed: No such file or directory (2)
rsync: link_stat "/root/the" failed: No such file or directory (2)
rsync: link_stat "/root/Magic/art" failed: No such file or directory (2)
rsync: link_stat "/home/indubitableness/.cache/vlc/art/artistalbum/Cake/Fashion" failed: No such file or directory (2)
rsync: link_stat "/root/Nugget/art" failed: No such file or directory (2)
What is this "link_stat" error and why is rsync looking in my /root directory in the first place?
These all seem to be errors caused by the lack of escaped spaces, a problem I fixed with the "find ... -print0 | xargs -0" commands I mentioned before. The files in /home/indubitableness that have spaced in them are getting backed up with this command despite the error messages.
Furthermore I can't seem to figure out how to make rsync copy the contents of the source directory to the destination directory using this find command as the input for rsync. I know when using rsync normally doing /home/ as opposed to /home is supposed to mean "copy the contents of home" but I keep getting a "home" directory in the destination. Is this something I'm just going to have to live with or can I force the behavior I'm looking for?
Edit:
This is the script I've been working on.
http://lfs.pastebin.com/x8LaH1G5
Note: The line '"${OUTPUT_DIR[$dirCount]}"' on line 86 includes the quotes because I was desperately casting around for a solution to the errors I'm seeing. It didn't help to put them in quotes.
The command doesn't seem to above posted errors from the command line. I also have a test script intended to simulate the variable substitution used in the above script in an attempt to replicate the errors. It looks like this:
Code:
#!/bin/sh
SOURCE[1]=/home/
DEST[1]=/media/Sanctuary/DAILY_BACKUP_INCREMENT/home_rsync/vroomfondel/
src_destNum=1
rsync --dry-run -Rav --delete --exclude-from=EXCLUDE_SYNC --delete-excluded `find ${SOURCE[$src_destNum]} -type f -ctime -1 -print0 | xargs -0` ${DEST[$src_destNum]}
The errors existed in the original script before I relegated all of rsync's options to variables and so I haven't yet put them in variables in the test script. The test script appears to run fine and I only seem to be getting the "rsync: -: unknown option" followed by the litany of "link_stat" errors when it moves into copying the /home directory. I am not seeing any of these errors using the test script.
HALP!