LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Recover from moving files into a file instead of folder (https://www.linuxquestions.org/questions/linux-software-2/recover-from-moving-files-into-a-file-instead-of-folder-4175590979/)

georider 10-07-2016 05:20 PM

Recover from moving files into a file instead of folder
 
So, honestly over the several years I've been administering and working with *nix, I have never done this. How, I'm not sure.

So, I was running a simple 'find . -iname '*.avi' -exec mv '{}' ../videos_avi \;' only the '../videos_avi' folder didn't exist. :(

Now, all the avi files are nestled snuggly in a file called videos_avi. I recall reading about how to split this up again, but for the life of me and all my googling powers I cannot locate the answer today.

Your insight would greatly be appreciated!

-g

rknichols 10-07-2016 06:53 PM

Sorry, but those files are not "nestled snuggly" in the videos_avi file. That file contains the last file that you moved there, and nothing else. Your problem now is the basic one of recovering deleted files. That's probably one you have run into before, and step one is to stop using the system. Every change in that filesystem decreases your chances for recovery.

For the future, know that you can protect against this sort of error by including the trailing "/" in the folder name. A trailing slash means, "an existing folder with this name," and will result in an error if that folder does not exist.

Keith Hedger 10-07-2016 06:56 PM

as there was no folder to move the files to the mv command would have overwritten the videos_avi file repeatedly so your files are gone execept for the last one that will have been renamed to vdeos_avi

rk you type faster than me!

georider 10-07-2016 08:24 PM

rk/Keith,

Thanks for your replies. This is actually a recovery operation already as these were recovered from a failing 2TB drive. So, I've got the originals. Just didn't want to wait another 2 weeks while running photorec again due to me being lazy. :) Yeah, I need to get back into the habit of using the trailing slash. And, I verified your thoughts that it simply kept overwriting the file. Now that I think about it, it makes perfect sense.

Have a good one.

-g


All times are GMT -5. The time now is 11:53 AM.