A typical result: 3192920088_originalname
Code: Select all
#!/bin/sh
#
# Randomize filenames of images in folder
#
for i in "$*"
do
folder=`dirname "$i"`
cd $folder
for i in ./*.jpg
do
mixed="$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" " )"
orig=`basename "$i" .jpg`
mv "$i" "$mixed"_"$orig".jpg
done
for i in ./*.png
do
mixed="$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" " )"
orig=`basename "$i" .png`
mv "$i" "$mixed"_"$orig".png
done
for i in ./*.gif
do
mixed="$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" " )"
orig=`basename "$i" .gif`
mv "$i" "$mixed"_"$orig".gif
done
for i in ./*.tif
do
mixed="$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" " )"
orig=`basename "$i" .tif`
mv "$i" "$mixed"_"$orig".tif
done
done