//View Tip #358
Similar Tips
» Mass-renaming files
» dos2unix all files in a directory
» Remove DS_Store files from shared folders
» Randomized find
» Add a line to files using find and echo

 

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 »




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