msgbartop
A chronological documentation test project, nothing serious, really!
msgbarbottom

10 Sep 2010 Randomize filenames

Posted by

This is a simple bash script to create random filenames of all jpg-files (*.jpg) in a folder using the linux commands mv, sha1sum and cut.

#!/bin/bash
# Randomize filenames

for fname in *.jpg;
do
        mv "$fname" $(echo "$fname" | \
                sha1sum | \
                cut -f1 -d ' ' | \
                cut -b 1-5).jpg
done

The jpg-files can have names like

08df4.jpg  
1e788.jpg  
315e6.jpg  
41e19.jpg  
5f7d0.jpg  
7471e.jpg

Tags: , , ,

Comments are closed.