Hi,
After - cough - some filesystem problems (reiserfs for the curious) I'm left with a lost+found directory of 9GB, about 5000 files. Since I do not have the patience of a Saint, and sadly do not employ the services of a small team of highly skilled, cheap and tidy imps to do this manually I am looking for somehow to script this into something more manageable. Does anyone have anything that will sort a large directory, preferably recursively and put in into any sort of order? Ideally I'd like to use the output of "file" to move filetypes together, but can't get the syntax correct...
Any ideas, pokes, acts of random abuse welcome :-)
I made such a tool 4u, but not test it ... put the file into your home dir and try :-)
usage: ~/FileSort.sh /lost+found
it should work recursively & make a new dir for every type of found files with the same name and put the files in
noro
#!/bin/bash
cd $1
for i in *
do
if [ -d $i ]; then
eval $HOME/FileSort.sh $i
exit
else
TYPE=`file -b $i`
mkdir -p ".$TYPE"
mv $i ".$TYPE"
fi
done
-- [EMAIL PROTECTED] mailing list
