Hello I made the mistake of using mv file.sql /destinationfolder
instead of mv file.sql destinationfolder/
- using su root. Now I can't find my sql file. is there a way to find it/recover it?
![](../../users/profiles/248882.webp)
- 103
- 1
-
You should modify your question specifying that `/destinationfolder` already existed and it contains files. – slybloty Oct 13 '14 at 17:18
2 Answers
Your ./file.sql
has become /destinationfolder
(this is not a folder but a file).
If you do ls /
you should see your file. If you do cat /destinationfolder
you should see content of your file.
With su
privilege move the file back:
mv /destinationfolder destinationfolder/file.sql
EDIT
I see you added some comments specifying that /destinationfolder
already existed and contained files. That means your file has been moved into this folder; so if you do ls /destinationfolder
you should see your file there. You might need su
permissions do access that folder.
Again, with su
privileges move the file back:
mv /destinationfolder/file.sql destinationfolder/file.sql
Note
/destinationfolder
is a folder part of your root directory /
destinationfolder/
is a folder part of your current working directory /current_working_directory/destinationfolder
![](../../users/profiles/127389.webp)
- 443
- 2
- 9
- 30
I would expect the file to be /destinationfilder so all you need to do is rename it back
sudo mv /destinationfolder /some/path/destinationfolder/file.sql
e.g.
touch file.sql
sudo mv file.sql /destinationfolder
ls -l /destinationfolder
-rw-rw-r--. 1 iain iain 0 Oct 13 16:52 /destinationfolder
sudo mv /destinationfolder /home/iain/destinationfolder/file.sql
ls -l /home/iain/destinationfolder/file.sql
-rw-rw-r--. 1 iain iain 0 Oct 13 16:52 file.sql
![](../../users/profiles/9517.webp)
- 114,104
- 20
- 206
- 289
-
there is already an existing folder with the name destinationfolder and it has files on it.what would happen if i mv back ? – nodejsj Oct 13 '14 at 15:55
-
thanks great!! I almost lost my breath all october data is on that file – nodejsj Oct 13 '14 at 15:57
-
1@stacknoob: Then why don't you have a backup if this might be the result? – Sven Oct 13 '14 at 16:48