Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Moving Files and Folders Accidentally to Non-existent Places

I often do the command such as:

mv folder $something_that_does_not_exist
mv files* $something_that_does_not_exist

Then, I realise that my files are gone. I cannot see them even in the folder "$something_that_does_not_exist". Where have my files and folders gone? How can I get them back?

like image 682
Léo Léopold Hertz 준영 Avatar asked May 01 '09 00:05

Léo Léopold Hertz 준영


1 Answers

In order to prevent this problem, I have a habit of always appending a / to the end of directory names when using cp or mv:

$ touch foo
$ mv foo bar/
mv: cannot move `foo' to `bar/foo': No such file or directory

Without the trailing slash, mv does a file rename operation. You may find that your file(s) have changed name.

like image 142
Greg Hewgill Avatar answered Nov 15 '22 08:11

Greg Hewgill