LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-29-2011, 12:24 PM   #1
wreckedred
LQ Newbie
 
Registered: Jan 2011
Posts: 2

Rep: Reputation: 0
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!
 
Old 01-29-2011, 01:12 PM   #2
Snark1994
Senior Member
 
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 345Reputation: 345Reputation: 345Reputation: 345
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"'?
 
Old 01-29-2011, 01:23 PM   #3
wreckedred
LQ Newbie
 
Registered: Jan 2011
Posts: 2

Original Poster
Rep: Reputation: 0
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.
 
Old 01-30-2011, 08:17 AM   #4
Snark1994
Senior Member
 
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 345Reputation: 345Reputation: 345Reputation: 345
Quote:
Originally Posted by wreckedred View Post
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How can I md5 recursively and place a checksum file in each directory? peter1234 Linux - General 10 11-14-2012 02:01 PM
List all files in a directory recursively, without the directories? b10m3ch4 Linux - General 4 11-12-2009 06:07 PM
Recursively move files one directory up FLX Linux - Newbie 8 10-06-2009 02:41 PM
how to find files in current directory only (not recursively) babu198649 Linux - Newbie 2 12-27-2007 02:30 AM
How to recursively rename files using their directory name pattern ceg4048 Linux - General 2 09-28-2005 02:16 PM


All times are GMT -5. The time now is 10:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration