LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 06-10-2011, 04:57 PM   #1
metallica1973
Senior Member
 
Registered: Feb 2003
Location: Washington D.C
Posts: 2,190

Rep: Reputation: 60
Excluding directories with find


I am trying to exclude 2 directories with find and pass it into cpio. I have tried

Code:
find . -depth -path '.evolution' -prune -o -path '.gconf' -prune -o -print|cpio -aov  > /media/caca/full$date
./.gconf/apps/evolution/memos/%gconf.xml
./.gconf/apps/evolution/memos
./.gconf/apps/evolution/tasks/%gconf.xml
./.gconf/apps/evolution/tasks
./.gconf/apps/evolution/shell/view_defaults/folder_bar/%gconf.xml
./.gconf/apps/evolution/shell/view_defaults/folder_bar
./.gconf/apps/evolution/shell/view_defaults/%gconf.xml
./.gconf/apps/evolution/shell/view_defaults/10.7.X_network
./.gconf/apps/evolution/shell/view_defaults/bash_history
as you can see it didnt exclude .gconf and

Code:
find . -depth \( -path ./evolution -prune -o -path ./gconf -prune \)  -print|cpio -aov  > /media/caca/full$date
1 block
Code:
find . \( -wholename ./evolution -o -wholename ./gconf \) -prune -o -type f -print0 | cpio -aov /media/caca/backup$date
cpio: Too many arguments
Code:
find . -type d \( -name ".evolution" -o -name ".gconf" \) -prune -o -print0 | cpio -aov /media/caca/backup$date
cpio: Too many arguments
what am I doing wrong?

Last edited by metallica1973; 06-10-2011 at 05:10 PM.
 
Old 06-10-2011, 05:08 PM   #2
Snark1994
Senior Member
 
Registered: Sep 2010
Distribution: Debian
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
I don't think you need the '-depth' flag

Code:
find . -path './FOO' -prune -o -path './BAR' -prune -o print
works for me, and if I add '-depth' between the '.' and '-path', it doesn't.

Hope this helps,

Last edited by Snark1994; 06-10-2011 at 05:09 PM. Reason: Added extra information
 
1 members found this post helpful.
Old 06-10-2011, 05:11 PM   #3
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Code:
find . \( -wholename ./.evolution -o -wholename ./.gconf \) -prune -o -print
Don't use the -depth option with -prune: it could change the result since the directory content is processed before the directory itself is excluded from the -prune option.
 
1 members found this post helpful.
Old 06-11-2011, 11:28 PM   #4
metallica1973
Senior Member
 
Registered: Feb 2003
Location: Washington D.C
Posts: 2,190

Original Poster
Rep: Reputation: 60
this worked

Code:
find . \( -wholename ./.evolution -o -wholename ./.gconf \) -prune -o -print
this didnt

Code:
find . -path './FOO' -prune -o -path './BAR' -prune -o print
thanks to all
 
Old 06-13-2011, 05:29 AM   #5
Snark1994
Senior Member
 
Registered: Sep 2010
Distribution: Debian
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
Hehe, sorry, look like I left the hyphen out before 'print'. If your problem is solved, could you mark the thread '[SOLVED]' too? Thanks
 
1 members found this post helpful.
  


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
Excluding multiple directories flamingo_l Linux - Newbie 11 08-03-2010 03:45 AM
excluding directories from commands David the H. Linux - General 5 04-06-2009 03:21 PM
Excluding directories from tar? LocoMojo Linux - Software 6 01-24-2006 01:01 AM
Find excluding multiple directories with a wildcard pteigeler Linux - Software 1 09-02-2005 10:57 AM
Excluding directories from zip files jonathanztaub Linux - General 1 05-17-2004 02:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration