Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a ton of notes categorized into folders, but I think it might be better to put them all into one folder instead. Is there an easy way to do that?

share|improve this question

migrated from stackoverflow.com May 23 '11 at 14:36

This question came from our site for professional and enthusiast programmers.

possible duplicate of How to copy all html files from a directory to another? – Gilles May 23 '11 at 22:25
find . -type f -execdir mv {} /my/dest/path/ \;

Warning if you have file name clashes this will lose some of the files with repeated names.

share|improve this answer
if you don't have execdir on your find you can always use exec instead. – awoodland May 23 '11 at 14:07
@Paul R - yes, I forgot that there, it's added now. – awoodland May 23 '11 at 14:12
depending on mv implementation, -i option may be of use to protect from collisions. – Michael Krelin - hacker May 23 '11 at 14:17
@Michael -b or -n might also be relevant for handling collisions, depending on which mv it is and what the desired behaviour is. – awoodland May 23 '11 at 14:25
I would use cp first, and remove the original only after verifying that everything is fine. – Adam Byrtek May 23 '11 at 18:18
$ set globstar
$ cp /source/dir/**/* /destination/dir/

The first line enables the recursive ** globbing in Bash (not necessary in Zsh).

share|improve this answer

Your Answer


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.