//View Tip #358
Similar Tips
» Pipe files to an archive
» Count files by type
» Rename many files using find and perl
» Add a line to files using find and echo
» Remove DS_Store files from shared folders


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