Tom
Tom

Reputation: 315

copy files across directories using terminal in mac

How to copy all files with an specific extension .SAV from one directory (including all subdirectories within that directory) to another one? I am using the terminal from mac. I have tried

    /Users/tournillon/my_directory/research_projects/dissertation_related/inequality
    Antonio-P-Tournillon-Ramoss-iMac:inequality tournillon$ ls
    Brazil              dhs_dados           imr201101app.pdf
    GHME_Education_final.pptx   dhs_sav_files
    Antonio-P-Tournillon-Ramoss-iMac:inequality tournillon$ dhs_dados /*.SAV/ dhs_sav_files/ 

I would assume this is a trivial task but I just can't get the syntax right.

Many thanks,

Antonio Pedro.

Upvotes: 4

Views: 10283

Answers (3)

POPOL
POPOL

Reputation: 308

Why not just use cp *.SAV directory

Upvotes: 1

njahnke
njahnke

Reputation: 1387

find /source/directory -iname \*.sav -exec cp {} /destination/directory/ \;

Upvotes: 14

Justin Jasmann
Justin Jasmann

Reputation: 2353

If you mean a UNIX copy,

cp -R <dirA>/*.sav <dirB>/

I'm not sure what dhs_dados is in your question..

Upvotes: 2

Related Questions