Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Well, I screwed up my external hard drive and now everything is in the lost+found folder. I can barely look through it because there is several tens of thousands of files (buncha inode things) and a lot of empty folders. My question is, is there anyway I can get straight to the video, audio, and image files that are strewn across these folders?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

I am not sure how (or even if) you could recover the original location of all the files. But at the very least you could start sorting them based on the content.

For starters, rox (aka Rox-Filer) is not dependent on file name extensions to know file type (it uses the actual file contents), so if you want a point and click browser that will open the files for inspection with the right app regardless of filename, I would try rox if Nautilus isn't working. If the problem with Nautilus is that the size of the directory is making it hard to use, in my experience rox works pretty well with huge directory listings as well (just be sure preview is turned off for images and video).

On the command line, the file command should tell you what kind of file each of the files is (I think that is the utility that rox is using internally). If you have some comfort with the command line you could even do some sorting via script (ie. move movies to one directory, audio files to another, etc.).

Edit

Here is something that may be helpful, I tested this on some copies of various files without the three letter filename extensions, so I know it works. It should be easy to check the output of file for various items to add clauses (and of course you will want to change the destination directories for all of this):

    #!/bin/sh

    mkdir -p ~/test-imgs;
    mkdir -p ~/test-vids;
    mkdir -p ~/test-music;

    for i in $*
    do
        ( [ -n "`file $i | grep image`" ] && mv $i ~/test-imgs )  ||
        ( [ -n "`file $i | grep video`" ] && mv $i ~/test-vids )  ||
        ( [ -n "`file $i | grep Audio`" ] && mv $i ~/test-music ) ||
        ( [ -n "`file $i | grep III`" ]   && mv $i ~/test-music )
    done
share|improve this answer
    
Thanks for the help. Rox hangs for about 3 minutes and then works like a charm :) After looking around, all the files that are directly in the lost+found folder are nothing but "socket", "tunnel", and other file system stuff. So now I guess I got to go through all those folders... :( Would that script go through those folders for me? –  RPG Master Mar 2 '10 at 17:48
    
The way it works is it moves any files you provide as arguments to one of the three directories, depending on file type, so you would invoke it as so (after saving it as filesorter.sh and set as executable): "./filesorter.sh *" would run it on every file in the current directory. If you really want to automatically sort the contents of the folders, you could change the script to "mkdir -p ./..." for each of the three folders instead of "mkdir -p ~/...", in order to preserve folder structure. You may want something using "find" that would recursively sort out each subdir of lost+found ... –  Justin Smith Mar 3 '10 at 1:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.