LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Find - Excluding multiple Directories w/o showing files within (https://www.linuxquestions.org/questions/linux-newbie-8/find-excluding-multiple-directories-w-o-showing-files-within-910808/)

pizzipie 10-29-2011 12:05 PM

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

jthill 10-29-2011 12:29 PM

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

You want `-type d` before the -print.

pizzipie 10-29-2011 05:11 PM

SOLVED: :cool: Thanks jthill that fixed it!


All times are GMT -5. The time now is 10:03 AM.