tags:

views:

46

answers:

3

So, How Do I find and copy all files,

*.a 

that are in,

 ~/DIR{1,2,3,...} 

to

 ~/tmp/foo?
A: 

In a bash shell:

cp ~/DIR*/*.a ~/tmp/foo
fmark
+3  A: 

Assumed you meant recursively copy everything of type .a from some source location. Haven't verified yet, but this should do that.

find <root-of-search> -type f -name '*.a' -exec cp {} /tmp/foo \;

replace with the top of wherever you want to search from. You might have to throw quotes around *.a, and you might have to replace escape the ending semicolon by putting it in single quotes rather than back-slashing it.

JustJeff
$ find . -type f -name *.mkv -exec cp {} ../disk0/public/foofind: paths must precede expression: foo.mkv
Eli
might be helpful to see if 'find' is working as intended; if you replace everything to the right of -exec with ls -l {} \; it should just list the files it's identified.
JustJeff
Sorry. I didn't read your post correctly. I did what you said and it seems to be working...is working. Thanks!
Eli
A: 
find ~/DIR{1,2,...} -name *.a print0 | xargs -i -0 cp '{}' ~/tmp/foo
Alex Reynolds