I drag and drop a folder into another by mistake in FileZilla.
~/big_folder
~/some_other_folder
The folder got moved is a very huge one. It includes hundreds of thousands of files (node_modules, small image files, a lot of folders)
What is so weird is that after I release my mouse, the moving is done. The folder "big_folder" is moved into "some_other_folder".
~/some_other_folder/big_folder
(there is no big_folder
in the ~/
after moving)
Then I realize the mistake and try move back but it fails both on FileZilla and terminal.
Then I have to cp -r
to copy files back because there are server-side codes accessing those files in ~/big_folder
And it takes like forever to wait …
What should I do?
BTW, here are the output from FileZilla (it's the failure of the moving back):
Status: Renaming '/root/big_folder' to '/root/some_other_folder/big_folder'
Status: /root/big_folder -> /root/some_other_folder/big_folder
Status: Renaming '/root/some_other_folder/big_folder' to '/root/big_folder'
Command: mv "big_folder" "/root/big_folder"
Error: mv /root/some_other_folder/big_folder /root/big_folder: received failure with description 'Failure'
Best Answer
If a directory is moved within the same filesystem (the same partition), then all that is needed is to rename the file path of the directory. No data apart from the directory entry for the directory itself has to be altered.
When copying directories, the data for each and every file needs to be duplicated. This involves reading all the source data and writing it at the destination.
Moving a directory between filesystems would involve copying the data to the destination and removing it from the source. This would take about as long time as copying (duplicating) the data within a single filesystem.
If FileZilla successfully renamed the directory from
~/big_folder
to~/some_other_folder/big_folder
, then I would revert that using... after first making sure that there were no directory called
~/big_folder
(if there was, the move would putbig_folder
fromsome_other_folder
into the~/big_folder
directory as a subfolder).