LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   rsync files recursively but place in one remote directory (https://www.linuxquestions.org/questions/linux-newbie-8/rsync-files-recursively-but-place-in-one-remote-directory-859431/)

wreckedred 01-29-2011 11:24 AM

rsync files recursively but place in one remote directory
 
i would like to find and backup all *.mp4 files from /Pictures and its sub-directories and move them to a single directory on a remote. I can find and move the files but I don't want the directory structure...just the files to be placed in the remote directory.

To find my files I use

rsync -r -a -v -e "ssh -l user" --delete --include '*/' --include '*.mp4' --exclude '*' /home/drew/Pictures/ remoteserver:/Users/drew/mp4

but this creates all the subdirectories

I also tried

find ~/Pictures -name "*.mp4" -exec rsync -r -a -v -e "ssh -l user" --delete {} remote:/Users/drew/mp4 \;

This works but takes forever

Any suggestions?

Thanks!

Snark1994 01-29-2011 12:12 PM

How many mp4 files do you have? This might be a big factor if you're moving them all into one directory. It depends on what filesystem you're using, and exactly what rsync does, but I'm pretty sure that many operations on the directory will have a running time of O(N) or at best O(logN), so putting loads of files in one directory would have rather adverse effects.

Also, have you tried using 'scp' rather than 'rsync -r -a -v -e "ssh -l user"'?

wreckedred 01-29-2011 12:23 PM

Thank you.

I have quite a few *.mp4 files and moving them into one directory isn't so much an issue for me on the remote machine. I have a video screensaver running on the remote that only looks for video files in a single directory.

scp was/is an option but copies every file every time....I couldn't figure out a way to make scp NOT overwrite if the file already exists on the remote.

Snark1994 01-30-2011 07:17 AM

Quote:

Originally Posted by wreckedred (Post 4241683)
I have quite a few *.mp4 files and moving them into one directory isn't so much an issue for me on the remote machine.

One of us is misunderstanding the other, but I don't know who :P I was talking about the amount of time it takes for rsync to copy a file into a directory - if you have a lot of files in a single directory it will slow down any operations on the directory. However, that's a theoretical limit, and I don't know if it would ever happen in practice.

Quote:

I have a video screensaver running on the remote that only looks for video files in a single directory.
This is perhaps something you could have mentioned in your first post ;) would writing a script like the one described in http://www.jwz.org/xscreensaver/faq.html#mpeg solve your problem? It will depend on what screensaver software you use, but xscreensaver has this functionality, and you would only need to add an extra bit to recurse through the directory

Quote:

scp was/is an option but copies every file every time....I couldn't figure out a way to make scp NOT overwrite if the file already exists on the remote.
Ah, yes. Quite right - in this case, rsync is a better option :)


All times are GMT -5. The time now is 11:35 PM.