LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 05-11-2004, 08:34 AM   #1
tnicol
LQ Newbie
 
Registered: Oct 2003
Location: Illinois
Posts: 2

Rep: Reputation: 0
Post rsync syntax to skip directory, but copy select files..


I'm trying to use rsync to backup from one drive to another. I'm having trouble with the syntax to skip a folder except for certain file extensions in that folder. No combination of --exclude, --include, --exclude-from, or --include-from seems to be able to handle it. I either get all of the folder I'm trying to skip or none of it. Any ideas?
 
Old 05-11-2004, 09:02 AM   #2
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
This should work.....

Where test is the directory you want to exclude and
*.txt are the files that you want to include.

--include "test/*.txt" --exclude "test/"
 
Old 05-11-2004, 07:25 PM   #3
tnicol
LQ Newbie
 
Registered: Oct 2003
Location: Illinois
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks, but --include "test/*.txt" --exclude "test/" doesn't do the trick. Nothing in directory "test" gets copied as long as the --exclude is there, even with the explicit --include of the files. Any other ideas?
 
Old 07-24-2007, 05:40 AM   #4
gloriant
Member
 
Registered: Sep 2004
Distribution: Debian{Woody,Sarge,Etch}, UbuntuLTS6.06, SuSE{6.2,8.0}
Posts: 42

Rep: Reputation: 15
This problem can be solved thus:
Code:
rsync -av '--include=test/*.txt' '--exclude=test/*' startdir/ targetdir/
the solution proposed by homey excluded test/ directory, while this only excludes the files in test directory.

I now still see a problem with the .txt-files in subdirectories of test...
Anybody ?
 
  


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
rsync syntax for local copy hoover93 Linux - Software 3 12-21-2012 02:39 AM
How do you copy hidden files from one directory to another? Akhran Linux - Newbie 19 12-29-2011 03:31 AM
No longer able to select files from my user home directory oily_rags Suse/Novell 4 11-06-2005 01:39 PM
copy 3 files to a directory and all subdirectories? snip128 Linux - Newbie 9 08-12-2005 09:18 PM
copy files from directory to directory without subfile ALInux Linux - General 2 06-03-2005 11:51 AM


All times are GMT -5. The time now is 09:07 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 Google+: linuxquestions
Open Source Consulting | Domain Registration