0

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?

nodejsj
  • 103
  • 1
  • You should modify your question specifying that `/destinationfolder` already existed and it contains files. – slybloty Oct 13 '14 at 17:18

2 Answers2

1

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

slybloty
  • 443
  • 2
  • 9
  • 30
0

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
user9517
  • 114,104
  • 20
  • 206
  • 289