LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 10-29-2011, 12:05 PM   #1
pizzipie
Member
 
Registered: Jun 2005
Location: Sagle, ID
Distribution: Ubuntu 13.04
Posts: 83

Rep: Reputation: 0
Find - Excluding multiple Directories w/o showing files within


Object: Create backup file of chosen directory with 'tar'.

I am trying to write a bash script using 'find' to produce an input file to 'tar'.

The line that creates the input file is below.

find . -type d \( -name JAVASCRIPT -o -name 'jqueryinaction*' \) -prune -o -print | sort > /home/rick/Desktop/tar-include-file

This does exclude the directories I don't want in the current directory and creates the file but it includes all the individual file names also.

I've also tried to use -path in the above with the same results.

The line below creates the correct format but, of course, includes the directories that I don't want.

find . -type d | sort > /home/rick/Desktop/b1-include-file

Thanks in advance for any help you can give me.

R
 
Old 10-29-2011, 12:29 PM   #2
jthill
Member
 
Registered: Mar 2010
Distribution: Arch
Posts: 209

Rep: Reputation: 65
You're passing no selection criteria to -print: everything that isn't pruned gets printed.

You want `-type d` before the -print.
 
1 members found this post helpful.
Old 10-29-2011, 05:11 PM   #3
pizzipie
Member
 
Registered: Jun 2005
Location: Sagle, ID
Distribution: Ubuntu 13.04
Posts: 83

Original Poster
Rep: Reputation: 0
SOLVED: Thanks jthill that fixed it!
 
  


Reply

Tags
bash, find


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
Find and excluding all hidden directories metallica1973 Linux - General 7 10-28-2011 04:47 PM
[SOLVED] Excluding directories with find metallica1973 Linux - General 4 06-13-2011 05:29 AM
Excluding multiple directories flamingo_l Linux - Newbie 11 08-03-2010 03:45 AM
Find excluding multiple directories with a wildcard pteigeler Linux - Software 1 09-02-2005 10:57 AM
find and copy files into multiple directories avargas22 Linux - Newbie 2 04-01-2004 11:11 AM


All times are GMT -5. The time now is 05:34 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