This commit is contained in:
Robohash 2011-08-08 20:19:08 +00:00
parent 6b1110a4d3
commit 74edc9fd2b
2 changed files with 26 additions and 20 deletions

View File

@ -1,20 +0,0 @@
function dircurse()
{
count=0
cd $1
for i in `ls -U`
do
echo mv $i $count#$i
count=`expr $count + 1`
if [ -d $i ]
then
dircurse $i
fi
done
}
if [ $? -lt 1 ]
then
echo "Usage: $0 directory"
fi
dircurse $1

26
tests/dircurse.sh Executable file
View File

@ -0,0 +1,26 @@
function dircurse()
{
local count
local i
local newfile
echo "Entering Dircurse for " $1
count=0
for i in `ls -U $1`
do
newfile=$1/`printf %03d $count`#$i
mv $1/$i $newfile
count=`expr $count + 1`
if [ -d $newfile ]
then
echo "Dircursing $newfile"
dircurse $newfile
fi
done
}
if [ $# -lt 1 ]
then
echo "Usage: $0 directory"
exit
fi
dircurse $1