//View Tip #358
Similar Tips
» Add a line to files using find and echo
» Remove empty directories
» Find and replace on specific files
» Moved Trac and Subversion repositories to another machine/direct
» Duplicate directory tree


Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow
Assign random names to all files in a folder (including subfolders!):

find . -type f -exec bash -c 'mv "$1" "./$RANDOM"' - {} \;

Note that this is a somewhat expensive operation, so it might take a few seconds for large numbers of files.

View Comments »


Add your comment

Comments are currently disabled
Your Name:
Might fail, if $RANDOM returns the same number on two calls during the run.
Posted 2011-05-06 01:10:35

Home Latest Browse Top 25 Random Hall Of Fame Contact Submit