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 used the command

mv folder_name ....

I thought by using .. twice, it would move it back two folders.

Unfortunately my files disappeared.

Can someone help me recover them?

share|improve this question
4  
history | grep mv will show which command you have exactly use. – Bahamut 23 hours ago
12  
Don't worry, your files are safe in .... ! – Pandya 21 hours ago
3  
2  
you meant ../.. – cat 15 hours ago
2  
Possible duplicate of "mv" command-- file vanished into non-directory – Scott 1 hour ago

Your directory is still there :)

You have renamed it ....

Because files whose names start with . are hidden, you cannot see the directory unless you display hidden files

run

ls -A

and there it is!

Revert the change:

mv .... original_folder_name

and do the move correctly

mv original_folder_name ../..
share|improve this answer

The correct form would have been

mv folder_name ../..

You've moved your folder to a new folder named ....; to recover your files, run

mv .... folder_name

Like many other commands, mv is somewhat dangerous because mistakes can in some cases cause unrecoverable loss of data (except from backups): anything which ends up being interpreted as "move these files to this file" will cause all the files apart from the last one to be lost (each file will be renamed in turn to the target). To prevent such mistakes, there are a number of techniques:

  • use -i, which tells mv to ask for confirmation before overwriting;
  • use -t to specify the target folder (so mv will only move to a target folder);
  • use a / at the end of the target folder's name.
share|improve this answer
4  
It's a good job you didn't do "mv folder_name/* ....", as that would have been unrecoverable – pjc50 23 hours ago
10  
$ mv dir/* .... -> mv: target ‘....’ is not a directory – Andrew Stubbs 19 hours ago
3  
Aargh, why did you do that? pjc50 said it was a good job you didn't do that! – Stephen Kitt 19 hours ago
4  
Ah actually it doesn't do anything... – Stephen Kitt 19 hours ago
3  
@StephenKitt: No, but it's very dangerous because of what can happen if there are exactly 2 files and you hit enter before typing the ..... For this reason I advise never to type commands of the form mv dir/* dest. Commands whose prefixes are dangerous operations are bad news. – R.. 6 hours ago

You just renamed your folder to ...., and since it starts with ., it's now hidden.

type mv .... foldername to recover it

you can also type ls -la to list it (since -a prints hidden files)

The correct way to descend files and folder two directories is mv fileorfolder ../../

share|improve this answer

For future reference, if you add a / to the end of the path, then the command will fail if the target isn't a pre-existing directory, for example mv foldername ..../

share|improve this answer

protected by Community 10 hours ago

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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