0

I mistakenly specified the destination directory 'Doc' when using the mv command, but there is no such directory. Now, I'm unable to locate my file. How can I find my file that seems to have been moved with an incorrect destination?

ahnaf@ahnaf:~/Downloads$ mv 9.xlsx ~/Doc

I used the following command to search for the file:

find ~/ -type f -name "9.xlsx"

Unfortunately, I had no luck finding it. What should I do now? Any further suggestions would be greatly appreciated.

0

1 Answer 1

4

Your file will be called Doc in ~ or your home directory.

Your mv or move command told it to move the file, and give it a new name, which was done. This may not have been your intention, but it's what you commanded.

2
  • Thank you so much! Your solution worked perfectly, and I've recovered my file. I appreciate your help and the explanation of what happened. Oct 1 at 3:42
  • 2
    FYI: If your command had been mv 9.xlsx ~/Doc/ instead (ie. a / so the command interpreter knew you wanted to move the file to a directory; you would have received an error that said "mv: cannot move '9.xlsx' to '~/Doc/': Not a directory" if no directory called /Doc (directory) exists within ~ .. ie. you can, by being more specific, reduce your chance of errors but POSIX/unix machines will do what we tell them to.
    – guiverc
    Oct 1 at 4:07

Not the answer you're looking for? Browse other questions tagged .