You are not logged in.
Hi,
I need to back up photos taken after a specific date.
At the current location (/photos/Photos) the photos are organized in a hierarchical structure (e.g., inside the photos folder there is a 2015 folder. Inside that folder there is a sub-folder for each date which includes all photos taken on that date).
I tried to following, but, in spite of the -a parameter, the TARGET has a flat structure WITHOUT subfolders.
Please advise!
Thnaks!
-------my command------------
find /photos/Photos -type f -newermt 20150529 -exec rsync -av {} /run/media/miki/Archieve03/Photos \;
Best regards,
Michael Badt
Offline
I think that's because you're feeding a flat list of files from find to rsync.
Try using rsync alone.
Offline
You' re right of course,
but rsync alone (as fas as I know) doesn't support dte filtering.
Anybody else?
Best regards,
Michael Badt
Offline
Have a look at --relative:
-R, --relative
Use relative paths. This means that the full path names specified on the command line are sent to the server rather than just the last parts of the filenames.
This is particularly useful when you want to send several different directories at the same time. For example, if you used this command:rsync -av /foo/bar/baz.c remote:/tmp/
... this would create a file named baz.c in /tmp/ on the remote machine. If instead you used
rsync -avR /foo/bar/baz.c remote:/tmp/
then a file named /tmp/foo/bar/baz.c would be created on the remote machine, preserving its full path. These extra path elements are called "implied directo‐
ries" (i.e. the "foo" and the "foo/bar" directories in the above example).Beginning with rsync 3.0.0, rsync always sends these implied directories as real directories in the file list, even if a path element is really a symlink on
the sending side. This prevents some really unexpected behaviors when copying the full path of a file that you didn’t realize had a symlink in its path. If
you want to duplicate a server-side symlink, include both the symlink via its path, and referent directory via its real path. If you’re dealing with an older
rsync on the sending side, you may need to use the --no-implied-dirs option.It is also possible to limit the amount of path information that is sent as implied directories for each path you specify. With a modern rsync on the sending
side (beginning with 2.6.7), you can insert a dot and a slash into the source path, like this:rsync -avR /foo/./bar/baz.c remote:/tmp/
That would create /tmp/bar/baz.c on the remote machine. (Note that the dot must be followed by a slash, so "/foo/." would not be abbreviated.) For older
rsync versions, you would need to use a chdir to limit the source path. For example, when pushing files:(cd /foo; rsync -avR bar/baz.c remote:/tmp/)
(Note that the parens put the two commands into a sub-shell, so that the "cd" command doesn’t remain in effect for future commands.) If you’re pulling files
from an older rsync, use this idiom (but only for a non-daemon transfer):rsync -avR --rsync-path="cd /foo; rsync" \
remote:bar/baz.c /tmp/
Offline
Thanks alot Spider for the comprehensive lesson. I'll try to implement.
Best regards,
Michael Badt
Offline