LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 07-29-2010, 04:14 AM   #1
sorvad
Member
 
Registered: Apr 2004
Location: Cumbria, England
Distribution: openSuSE, Centos, HP-UX
Posts: 53

Rep: Reputation: 15
Question Excluding executables in a sub-directory from tar backups


Just trying to set up a new backup using tar, but there are a few things I dont want to include. Using --exclude I can exclude sub-directories, but how do I exclude specific files in a subdirectory that are (for instance) executables or have a specific extension?
 
Old 07-29-2010, 04:18 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Hi,

Answered a similar question here at LQ a while back. Have a look here tar excluding some files

Hope this helps.
 
Old 07-29-2010, 04:28 AM   #3
sorvad
Member
 
Registered: Apr 2004
Location: Cumbria, England
Distribution: openSuSE, Centos, HP-UX
Posts: 53

Original Poster
Rep: Reputation: 15
Hi druuna - thats great, but only solves part of problem - any idea how I exclude files with executable permission in the sub-directory?
 
Old 07-29-2010, 04:42 AM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Hi,

You can create a file with executables like this: find /path/to/dir -type f -perm -u=x > exclude.list

Use this exclude list to feed tar.

Hope this helps.
 
Old 07-29-2010, 05:59 AM   #5
sorvad
Member
 
Registered: Apr 2004
Location: Cumbria, England
Distribution: openSuSE, Centos, HP-UX
Posts: 53

Original Poster
Rep: Reputation: 15
Thumbs up

Thanks druuna
 
Old 07-29-2010, 06:04 AM   #6
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
You're welcome
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] tar excluding some files infraquest Linux - Newbie 7 06-11-2010 06:35 AM
Excluding directories from tar? LocoMojo Linux - Software 6 01-24-2006 01:01 AM
excluding hidden directories when using tar djgerbavore Slackware 3 01-05-2006 03:49 PM
tar, excluding directories recursively towlie Linux - Newbie 3 06-17-2004 12:32 PM
tar and excluding files murshed Linux - Newbie 7 03-15-2003 02:32 PM


All times are GMT -5. The time now is 02:47 AM.

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