Wrong mv command. Where did my files go?
Your directory is still there :)
You have renamed it ....
Because files whose names start with .
are hidden, you cannot see the directory unless you display hidden files
run
ls -A
and there it is!
Revert the change:
mv .... original_folder_name
and do the move correctly
mv original_folder_name ../..
The correct form would have been
mv folder_name ../..
You've moved your folder to a new folder named ....
; to recover your files, run
mv .... folder_name
Like many other commands, mv
is somewhat dangerous because mistakes can in some cases cause unrecoverable loss of data (except from backups): anything which ends up being interpreted as "move these files to this file" will cause all the files apart from the last one to be lost (each file will be renamed in turn to the target). To prevent such mistakes, there are a number of techniques:
- use
-i
, which tellsmv
to ask for confirmation before overwriting; - use
-t
to specify the target folder (somv
will only move to a target folder); - use a
/
at the end of the target folder's name.
You just renamed your folder to ....
, and since it starts with .
, it's now hidden.
type mv .... foldername
to recover it
you can also type ls -la
to list it (since -a
prints hidden files)
The correct way to descend files and folder two directories is mv fileorfolder ../../