Saturday, April 27, 2024
10
rated 0 times [  10] [ 0]  / answers: 1 / hits: 14658  / 3 Years ago, sat, july 10, 2021, 5:58:16

Ok, so I have a digital photo frame that I have, and view my photos from a USB.
Everything works fine, however, there is no way to display the pictures randomly. So, I have to watch my pictures in order, which is fine but not really what I want.



I am wondering if there is a way to have my .jpg pictures, that I view to be batch renamed, but renamed randomly? Be it adding random characters to the start of the name or replacing the characters before .jpg



Thank you for your time and answers.


More From » batch-rename

 Answers
5

I suppose the following could work. Assuming the prefix of your filenames is "DSC" you can use the following command in the terminal (untested!)



cd /path/to/photos
rename 's/DSC/'$RANDOM'/' *.jpg


This uses the perl rename command to match regular expressions and replace them. In this case, we are substituting "DSC" with a random number in the filename for all .jpg files. Change the "DSC" to whatever your photos' prefix is.



another method (also untested) is with a bash script:



#!/bin/bash
for f in *.jpg; do
mv "$f" $RANDOM-"$f"
done

[#31230] Sunday, July 11, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ameatoes

Total Points: 321
Total Questions: 106
Total Answers: 112

Location: Belarus
Member since Sat, Jul 18, 2020
4 Years ago
;