//View Tip #358
Similar Tips
» Rename many files using find and perl
» Find and remove core files
» Randomized find
» Find and Grep
» dos2unix all files in a directory


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