I have a bunch of photos with varying names.
I want to give each photo a random name(*), how do I do that?
(*)I'm going to put them on a digital photo-frame that can't shuffle
54 Answers
Assuming all the images are in a single folder, this would work in powershell:
Get-ChildItem *.jpg | ForEach-Object{Rename-Item $_ -NewName "$(Get-Random)-$($_.Name).jpg"}It is possible that you would get potential name collisions, but Get-Random by default returns a 32 bit unsigned int from 0 to Int32.MaxValue (0 to 2147483647). You could certainly add another Get-Random in to reduce the likelihood of a collision just as in the Bash answer.
1One way if you have a bash shell handy is to use the $RANDOM environment variable. It generates random values between 0 and 32767.
A simple for loop in bash works fine if you only have a few hundred files.
for i in *.jpg; do mv -i "$i" ${RANDOM}.jpg; doneSince I had about 4000 files to rename I soon got collisions that the -i flag to mv caught.
Adding another $RANDOM took care of that.
for i in *.jpg; do mv -i "$i" ${RANDOM}${RANDOM}.jpg; done 4 for f in *; do ext=$(echo "$f" | sed 's|\([^.]*\)||'); mv "$f" "$(uuidgen)$ext"; done
Most batch file renamers can do this, here is one
Easy method would be to do a sequential numbering of the file, I am sure there other options with this software, use your imagination.
Here is the one I use for bulk renaming tasks