I want to rsync the files to my local linux box, but I only want files that have been created or modified within the past 30 days.
I'm mounting a windows share from linux using this command:
mount -t cifs //Share/public /mnt/ntserver -o username=myuser,password='password',domain=sub.domain.com
It mounts correctly and I can ls the mount:
$ mount
//Share/public/ on /mnt/ntserver type cifs (rw,mand)
From my research, it seems rsync can't do this alone, but with the help of 'find', it's possible.
Below, the command is only finding files created or modified exactly 30 days ago (from -ctime 30), which is returning no files to be rsynced.
cd /mnt/ntserver/documentation/ && find . -type f -ctime 30 | rsync -av --max-size=5m --include '*/' --include '*.xls*' --include '*.doc*' --include '*.pl' --include '*.sh' --include '*.sql' --include '*.txt' --include '*.vsd' --exclude '*' --files-from=- /mnt/ntserver/documentation /home/dan/cifs/
building file list ... done
sent 10 bytes received 12 bytes 2.93 bytes/sec
total size is 0 speedup is 0.00
But, if I change the -ctime to 29, it finds files:
cd /mnt/ntserver/documentation/ && find . -type f -ctime 29 | rsync -av --max-size=5m --include '*/' --include '*.xls*' --include '*.doc*' --include '*.pl' --include '*.sh' --include '*.sql' --include '*.txt' --include '*.vsd' --exclude '*' --files-from=- /mnt/ntserver/documentation /home/dan/cifs/
building file list ... done
doc1.xlsx
doc2.xlsx
doc3.xlsx
sent 6657515 bytes received 91 bytes 783247.76 bytes/sec
total size is 14039237 speedup is 2.11
What am I doing wrong? Why isn't it finding all files created/modified within the past 30 day?