Tuesday, January 18, 2011

ubuntu how to copy all file types to a single folder

So I wanted to figure out an easy way to search my computer and my servers for a specific file type, in my case .eps figure files and copy them all to a single folder for me to review.

So first I need to make a folder to copy them do so I did this:

First I made the directory
mkdir figall

Move to the root folder
cd /

Now copy all files with extension .eps to my folder
sudo find -name "*.eps" -exec cp \{\} ~/Desktop/figall/ \;

Now I could repeat this for any file extension:
sudo find -name "*.jpg" -exec cp \{\} ~/Desktop/jpgall/ \;
sudo find -name "*.doc" -exec cp \{\} ~/Desktop/docall/ \;
sudo find -name "*.tex" -exec cp \{\} ~/Desktop/texall/ \;






No comments: