Copy files through directories using terminal on mac

How to copy all files with a specific .SAV extension from one directory (including all subdirectories in this directory) to another? I am using a terminal from mac. I 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 suggest that this is a trivial task, but I just can't get the syntax right.

Thank you very much,

Antonio Pedro.

+4
source share
3 answers

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

+14
source

If you mean a copy of UNIX,

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

I am not sure what dhs_dados is in your question.

+2
source

Why not just use the cp * .SAV directory

+1
source

All Articles