Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Situation: I finally convinced my dad to let me install Xubuntu on his desktop, since Windows XP had become extremely bloated, old - it's a mess. So I installed Xubuntu 12.10 alongside the Windows partition, and he wants me to move all his .doc and .xls files to the new partition before I erase the Windows partition. This is easier said than done. My dad has subdirectories upon subdirectories, and I really don't want to have to manually go through every single folder to get all his documents and spreadsheets.

Question: How do I move all his .doc and .xls files to a new folder?

Additional Info: I know there are ways to move all files, but I only want to move files of a certain type (.doc, .xls). I've already tried find "/media/gregory/Secondary/Documents and Settings/Gregory Davidson" -name '*.doc' | xargs -i cp /home/gregory/Documents, but when I manually checked, it hadn't moved the documents in many, if not all, of the subdirectories.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Assuming you are in the directory that you want to copy files from,

cp -r **/{*.doc,*.xls} /wherever/you/want/

would do the trick.

share|improve this answer
    
I forgot I would have to be in the original directory; Now I feel stupid :/ Thanks for the quick response! –  DaimyoKirby Nov 22 '12 at 15:45
    
You're welcome:) –  cadadr Nov 22 '12 at 15:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.