- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: rsync - excluding directories
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-02-2011 07:59 AM
тАО06-02-2011 07:59 AM
rsync - excluding directories
I need to copy all the .txt files from certain directory and it's subdirectories preserving timestamps permissions etc.
Rsync is great for that but I ccan't find out how to tell it not to copy the directories - just the files.
- Tags:
- rsync
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-02-2011 03:01 PM
тАО06-02-2011 03:01 PM
Re: rsync - excluding directories
that is a normal behavior for rsync. Best bet would be to cd into the dir/sub dir first, then do a rsync *.txt dest:/dir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-03-2011 09:55 AM
тАО06-03-2011 09:55 AM
Re: rsync - excluding directories
dir=$(mktemp -d) && rsync -a --include '*/' --include='*.txt' --exclude='*' SOURCEHOST:/SOURCEDIR/ $dir && find $dir -type f -exec mv {} TARGETDIR \; && rm -rf $dir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-04-2011 11:27 AM
тАО06-04-2011 11:27 AM
Re: rsync - excluding directories
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-04-2011 01:30 PM
тАО06-04-2011 01:30 PM
Re: rsync - excluding directories
> Did you want to flatten the directory
> structure?
That was my guess. As usual, showing an
actual example might be more helpful than a
vague description.
If you're not wedded to rsync, then the
Info-ZIP Zip and UnZip programs (both) offer
a "-j" option to avoid storing or restoring
directories. I'd also expect that GNU "tar"
options like --strip-components and/or
--transform should be able to do the job at
extraction. Either way, it should be
possible to preserve the date-time, UID+GID,
and permission info.
http://www.gnu.org/software/tar/manual/html_node/transform.html
> [...] it's subdirectories [...]
That's "its subdirectories".