December 16, 201213 yr Hey guys, i have a script to update an external harddrive with my media to give to my friends. I always thought it worked fine but i did a big update on friday night and i noticed it ignored one of the films added the day before that and there are some folders that are empty. (seems like the couchpotato ones that only have the extra files for xbmc etc but not the .mkv) Here is my script if anyone wants to look at it. thanks alot #/bin/bash echo "Update toshiba for the last how many days?" read days echo "Update Movies? [y/n]" read ans echo "Update TV? [y/n]" read ansTwo echo "Update Music? [y/n]" read ansThree if [ $ans = y -o $ans = Y -o $ans = yes -o $ans = Yes -o $ans = YES ] then echo "Starting Movies..." cd /mnt/user/Movies/ rsync -av --files-from=<(find -type f -mtime -$days) /mnt/user/Movies/ /mnt/disk/Toshiba/Movies/ fi if [ $ansTwo = y -o $ansTwo = Y -o $ansTwo = yes -o $ansTwo = Yes -o $ansTwo = YES ] then echo "Starting TV..." cd /mnt/user/TV/ rsync -av --files-from=<(find -type f -mtime -$days) /mnt/user/TV/ /mnt/disk/Toshiba/TV/ fi if [ $ansThree = y -o $ansThree = Y -o $ansThree = yes -o $ansThree = Yes -o $ansThree = YES ] then echo "Starting Music..." cd /mnt/user/Music/ rsync -av --files-from=<(find -type f -mtime -$days) /mnt/user/Music/ /mnt/disk/Toshiba/Music/ fi echo " ______________________" echo "| |" echo "| COMPLETE |" echo "|______________________|"
December 16, 201213 yr the files you downloaded often have a mtime, that's very old. it's the timestamp of when the file was created and zipped for distribution. so if you download an old release (i.e. 400 days old) and start your script to copy the last 60 days, this file will not be copied. mtime only changes, when the file content changes. it's not the day of your download. it would be better to check for ctime (the time, the file was changed (any change counts, owner, permissions, etc). but i don't know, if rsync supports ctime.
December 16, 201213 yr Author oh thanks alot benni-chan. I had a feeling it was something like that. I will change it to the date modified as every file gets renamed. thanks alot :]
Archived
This topic is now archived and is closed to further replies.