LinuxQuestions.org
Help answer threads with 0 replies.
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
 
LinkBack Search this Thread
Old 01-14-2011, 09:12 AM   #1
kilee
LQ Newbie
 
Registered: Nov 2009
Posts: 4

Rep: Reputation: 0
rsync to copy specific files


Hi friends!
I'm trying to copy all my jpg files to another folder.
I'm using the following instruction:

rsync -r -n -t -v --progress --ignore-existing --include=*.jpg --exclude * /Users/me/Documents/ /Users/me/Desktop/

The problem is that it is copying the pictures in the "root" folder, it does not search and copy the recursive folders. There are several directories below the original folder.

-r is supposed to make the search recursive, but I can't find what is missing.

Thanks in advance!
 
Old 01-14-2011, 10:10 AM   #2
redgoblin
Member
 
Registered: Jun 2005
Location: UK
Distribution: Debian
Posts: 189

Rep: Reputation: 40
It looks like your exclude expression is excluding everything which includes directories. So there's no tree to go through.

Try explicitly including directories with;

rsync -r -n -t -v --progress --ignore-existing --include=*.jpg --include=*/ --exclude=* /Users/me/Documents/ /Users/me/Desktop/
 
Old 01-14-2011, 09:26 PM   #3
frankbell
Senior Member
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Debian
Posts: 3,753

Rep: Reputation: 637Reputation: 637Reputation: 637Reputation: 637Reputation: 637Reputation: 637
I think that scp would be better for this purpose.

Entering a directory and issuing scp *.jpg [user]@[target address]:[target path] would copy all the *.jpg files from the source directory to the target directory.

You can also scp -r a directory.

More about scp: http://linux.about.com/od/commands/l/blcmdl1_scp.htm
 
Old 01-15-2011, 07:13 AM   #4
jv2112
Member
 
Registered: Jan 2009
Location: New England
Distribution: Arch Linux
Posts: 447

Rep: Reputation: 67
You can add the -a option and it will copy recursively.
 
Old 01-15-2011, 08:23 AM   #5
kilee
LQ Newbie
 
Registered: Nov 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Thanks to all. I'll try them today and post the results.

Have a great day.
 
  


Reply

Tags
copy, rsync


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Files seem to take up more space in destination after rsync copy Karderio Linux - Newbie 5 02-24-2012 08:30 PM
Rsync can't copy certain files with unusual characters while cp can smithaa02 Linux - Software 7 11-15-2010 02:26 PM
copy files containing specific words in a specified line abenmao Linux - Newbie 5 08-28-2008 09:04 AM
How to copy a specific no of files from a group of files biswa_nayak Programming 2 05-11-2008 12:21 PM
sudo rsync -uvrlpot doesn't copy some files xpucto Linux - Newbie 1 01-15-2007 06:56 AM


All times are GMT -5. The time now is 04:09 PM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration