E. M. Recio on 15 Jan 2010 06:16:11 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] find, xargs, tar and ssh or selectively backing up some files on another server


On Thursday 17 December 2009 14:44:55 Kevin McAllister wrote:
> On Dec 17, 2009, at 12:58 PM, Matthew Edlefsen wrote:
> > find voicemail/*/*/INBOX -type f -mtime +180 -print | tar -cT - | ssh ...
> >
> > should work
> >
> > -T FILE tells tar to read a list of files to tar from FILE.

How do you tell find to exclude a list of files or a pattern. For example, I 
want to list files under foo/ but exclude all files in directories and 
subdirectories called .bar and execute a command on each file

./foo/a/b
./foo/a/.bar/e
./foo/a/.bar/f
./foo/a/g/e
./foo/a/g/.bar/h
./foo/a/g/.bar/i
./foo/c/d

Currnently, I use

for i in `find ./ -type f | grep -v ".bar"`; do MyCommand.sh $i; done

But there should be a way I can do

find ./ -type f XXXXX -exec MyCommand.sh \{\} \;

Where XXXXX would be the exclude option.

-elmo

Attachment: signature.asc
Description: This is a digitally signed message part.

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug