mohit tomar
New Member
Hello,
I was working with some obsolete xls/xlsx files and at the same time learning to work with commands. As I'm a beginner with linux. However what I discovered is that mv command should be used with utmost care as what seemed to me is that it is as dangerous as rm command.
So following is the command that I ran and the result it had.
"find . -type f -name '*.xls*' | xargs -I '{}' mv {} xls_files_destination"
However there isn't anything wrong with this command but what mistake I made was that I mistyped the destination directory name which was actually xls-files-destination. And this resulted in find command locating all the xls and xlsx files on the current directory "." and then moved all those files to a new file called xls_files_destination.
At the beginning of this exercise I had a total 2243 xls files as i used "| wc -l" pipe to check for the total files. The find command took 2-3 seconds and turned all the xls files into nothing.
Now there is no xls files in my folder and the size of new xls-files-destination file is also just 91b.. ;-)
hehehe..
I was wondering how fast I would have lost my job if this was done on an actual production system.
Anyways all the xls files were just useless old data.
What I'm looking for is if there is a way if such an accident happen in real then how to recover the files.
Thanks in advance
I was working with some obsolete xls/xlsx files and at the same time learning to work with commands. As I'm a beginner with linux. However what I discovered is that mv command should be used with utmost care as what seemed to me is that it is as dangerous as rm command.
So following is the command that I ran and the result it had.
"find . -type f -name '*.xls*' | xargs -I '{}' mv {} xls_files_destination"
However there isn't anything wrong with this command but what mistake I made was that I mistyped the destination directory name which was actually xls-files-destination. And this resulted in find command locating all the xls and xlsx files on the current directory "." and then moved all those files to a new file called xls_files_destination.
At the beginning of this exercise I had a total 2243 xls files as i used "| wc -l" pipe to check for the total files. The find command took 2-3 seconds and turned all the xls files into nothing.
Now there is no xls files in my folder and the size of new xls-files-destination file is also just 91b.. ;-)
I was wondering how fast I would have lost my job if this was done on an actual production system.
Anyways all the xls files were just useless old data.
What I'm looking for is if there is a way if such an accident happen in real then how to recover the files.
Thanks in advance