I import from two digital cameras (one camera and one phone)
Datestamp on the phone is accurate and I try to keep it correct in the camera too
I want to rename the pictures with date+time as that makes much more sense than DSC001 and the like
I've seen solutions that are a bit towards this, but not a satisfactory solution
Then looking at a photo of my wife or me it's easy to see how much we age
Bulk renaming photos
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Bulk renaming photos
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Try this: ... and then take a good look at the list you get. There are a few candidates that you could check out .... e.g. gwenrname, krename, mrename, renameutils, purrr ...... Take a closer look at those packages, e.g. ... I am sure one or the other package should be able to do what you want.
Or you write a nice shell script
Code: Select all
apt-cache search rename | sort | more
Code: Select all
apt-cache show purrr
Or you write a nice shell script
Yeah right. We write complicated Python programs (and we'd need to learn the language first ) for stuff the shell can already do more efficiently out of the box and right away.Husse wrote: but it takes time to learn - lets say python - and then write it
Very efficient
Seriously: All you need is a decent for ... do ...; done loop in bash and then have it auto-move your files into their new names. It would of course help if you e.g. had provided a listing of the files so we can see their names
Like this? Got it from some how-to script writing site, and it works well with wild cards.
#!/bin/bash
search=`gdialog --title "Rename files" --inputbox "Search for" 200 450 2>&1` || exit
replace=`gdialog --title "Rename files" --inputbox "Replace with" 200 450 2>&1` || exit
path=`echo -n "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | head -n 1 | sed 's/[^\/]*$//'`
while [ $# -gt 0 ]; do
newname=`echo "$1" | sed -e "s/$search/$replace/g"`
mv "$path$1" "$path$newname"
shift
done
#!/bin/bash
search=`gdialog --title "Rename files" --inputbox "Search for" 200 450 2>&1` || exit
replace=`gdialog --title "Rename files" --inputbox "Replace with" 200 450 2>&1` || exit
path=`echo -n "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | head -n 1 | sed 's/[^\/]*$//'`
while [ $# -gt 0 ]; do
newname=`echo "$1" | sed -e "s/$search/$replace/g"`
mv "$path$1" "$path$newname"
shift
done
My HP cameras always produce files that start with the letters hpim.... something. So if I wanted to do something like you I'd do it like this.
Original directory listing (produced with 'ls -A1'):
This simple 'for' loop here (yes, this program is a 1-liner!) will copy them to their new filenames using their time stamps:
Directory listing afterwards:
All done in the the shell with standard shell commands
Original directory listing (produced with 'ls -A1'):
Code: Select all
...
hpim2043.jpg
hpim2044.jpg
hpim2045.jpg
hpim2046.jpg
hpim2047.jpg
hpim2048.jpg
hpim2049.jpg
hpim2050.jpg
hpim2052.jpg
hpim2053.jpg
hpim2054.jpg
hpim2055.jpg
hpim2056.jpg
hpim2057.jpg
hpim2058.jpg
hpim2059.jpg
hpim2060.jpg
hpim2061.jpg
hpim2062.jpg
hpim2063.jpg
hpim2064.jpg
hpim2065.jpg
hpim2066.jpg
hpim2067.jpg
...
Code: Select all
for d in `ls -A1 hpim* | cut -c -8`; do NEWFILEEND=`ls -Al $d* | awk '{ print $6,$7}' | tr " " "_"`; cp $d"_"$NEWFILEEND".jpg"; done
Code: Select all
...
hpim1587_2007-01-24_20:41.jpg
hpim1589_2007-01-24_20:41.jpg
hpim1590_2007-01-24_23:21.jpg
hpim1591_2007-01-24_23:22.jpg
hpim1592_2007-01-24_23:22.jpg
hpim1593_2007-01-24_23:22.jpg
hpim1594_2007-01-26_06:31.jpg
hpim1595_2007-01-26_06:32.jpg
hpim1596_2007-02-01_21:32.jpg
hpim1597_2007-02-01_21:32.jpg
hpim1598_2007-02-01_21:33.jpg
hpim1599_2007-02-01_21:33.jpg
hpim1601_2007-02-01_21:33.jpg
hpim1602_2007-02-01_21:33.jpg
hpim1603_2007-02-02_02:55.jpg
hpim1605_2007-02-02_02:59.jpg
hpim1610_2007-02-02_03:06.jpg
hpim1613_2007-02-02_03:07.jpg
hpim1614_2007-02-02_03:08.jpg
hpim1617_2007-02-03_00:31.jpg
hpim1619_2007-02-03_00:31.jpg
hpim1620_2007-02-03_00:32.jpg
hpim1621_2007-02-03_00:32.jpg
hpim1625_2007-02-03_22:27.jpg
hpim1627_2007-02-03_22:28.jpg
hpim1629_2007-02-04_00:37.jpg
hpim1632_2007-02-04_00:55.jpg
hpim1634_2007-02-04_05:53.jpg
hpim1635_2007-02-04_05:53.jpg
hpim1636_2007-02-14_06:59.jpg
hpim1637_2007-02-14_06:59.jpg
...