Page 1 of 1

Linux Help

Posted: Sat Jan 24, 2009 3:11 pm
by mike
Hey, I need help with Linux. Recently had a format issue and lost all my files so now I'm sifting through the OVER 1 MILLION pictures recovered by foremost. The system crashes whenever I try to look in the folder holding all the files so I just move over 10000 at a time to a temp folder so that I can browse them (looking at the thumbnail is enough to see if it's junk or something I want). What I need is a command for doing this.. what I currently do is just start moving stuff and then kill the command after some time; not an exact science. Can anyone help me out?

PS: I'm posting this here because other Linux help places are too fucking slow... even on IRC I get no replies.

Re: Linux Help

Posted: Sat Jan 24, 2009 3:51 pm
by Kaze
Use a loop..

Code: Select all

mkdir tmp
N=0
for file in `ls`
do
    if [ $N -gt 10000 ]; then
        break
    fi
    mv $file tmp
    
    N=`expr $N + 1`
done
Untested

Re: Linux Help

Posted: Sat Jan 24, 2009 5:45 pm
by mike
It's a lot slower, but it does mean that I can be unattentive and not end up with 90000+ files in an unusable folder. Thanks! ^^