Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

General setup


Command I ran:

find ./dir -type f -iname "*" -exec mv {} --target-directory=dir-tar /;

I was in root-dir (note dir-tar is inside root-dir)


No sub-directories were moved. All files are now listed in dir-tar without their subdirectories (basically unorganized mess!)

So any help is appreciated. Is their any info on what went where? I tried ls -lrt to look at dates or times, but there is no real pattern to piece it back together.

Any help is appreciated. Thanks.

share|improve this question
Do you have an archive of any sort, however out-of-date? That would give you the directory structure. You might be able to script most of the undo from that, leaving only a few cases you need to look at by hand. – Nicole Hamilton Nov 17 '12 at 18:39
up vote 1 down vote accepted

Well, find did what you asked it to. It found every file and moved every file. Unless you have some kind of reference to look at (backup, archive) I believe it is next to impossible to restore the original structure because as far as I know, filesystems don't have a reverse option for moving files.

In the future, it may be wise to prepent an "echo" to you command, so that you see what will happen before executing it. In this particular case, what you wanted done could be achieved with mv dir/* tar-dir or:

find /path -type d -maxlevel 1 -exec -->echo<-- mv {} /dest/ \;
share|improve this answer
Hi Thanks... (getting back to this post a little late). – syntax Nov 28 '12 at 16:58
@syntax, welcome to SU! While thanks are always appreciated, the way to thank people on the SE network is to upvote their answer. – terdon Nov 28 '12 at 17:11
Simple and easy, if too complicated, take break: also thanks for echo (@terdon i was interrupted, doing it now) – syntax Nov 28 '12 at 17:37

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.