Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I typed a command to refactor my file from the current folder I was in to another folder.

What I wanted was: mv /var/backup /var/www/backup

However, I typed: mv /var/backup /var/www/

Now I can't seem to find my file anywhere! Is there a way I can recover it?

share|improve this question
4  
Have you looked in /var/www? It should be there as long as the /var/www directory existed. If it did not, your file has been renamed to /var/www. –  terdon May 11 at 15:28

1 Answer 1

If some error happened, mv prints an error message and returns a non-zero status.

If mv didn't print anything then the move happened as you wrote it:

  • If /var/www did not exist, then you renamed /var/backup to /var/www.
  • If /var/www was an existing directory, then you moved /var/backup to /var/www/backup.

If neither of these happened, then either you typed a different command or you (or someone else) did something else to those files afterwards.

share|improve this answer

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.