11

pyrenamer is an excellent bulk file renaming tool. But I could not find it in the repository for 18.04 Bionic Beaver or a PPA.
I use it all the time to rename photo images before importing into the Shotwell image library management system.

In particular, I use a pattern to get names in the form yyyymmdd including a day of the week (it is so much easier to remember the day of the week one visited the zoo) and the model name of the camera used. The ~ symbol helps if one wants to search and replace to revert to the original file image name. See:

{imageyear}{imagemonth}{imageday}_{imagedaysimp}_{imagehour}{imageminute}{imagesecond}_{cameramodel}~{1}

If a PPA becomes available for 18.04 please inform here.

Melebius
  • 11,431
  • 9
  • 52
  • 78
user824808
  • 319
  • 1
  • 4
  • 17

6 Answers6

10

This problem can also be solved natively in 18.04 by installing another similar GUI batch renamer app from the default Ubuntu repositories. GPRename easily can replace, remove, insert, delete and number consecutively files and directories. GPRename can be installed in 18.04 and later with the following command:

sudo apt install gprename  

To get the functionality of reading EXIF metadata tags in 18.04 install renrot. renrot can rename and rotate files according to EXIF tags. renrot can be installed in 18.04 and later with the following command:

sudo apt install renrot  

enter image description here

karel
  • 114,770
  • Good native 18.04 solution. But I'm not sure if gprename can read the EXIF metadata tags from photo files which is a convenient and powerful feature of pyrenamer. – user824808 May 02 '18 at 10:25
  • I added info about how to read EXIF metadata tags from photo files in 18.04 to my answer. – karel May 02 '18 at 10:30
  • I have a directory of JPG files named DSC03517, DSC03518, DSC03519 , DSC03520, etc. I want to rename them to something more meaningful, e.g. London-04-Aug-2018-001, London-04-Aug-2018-002, London-04-Aug-2018-003, London-04-Aug-2018-004, etc. I will type the place and date, it's not necessary to use EXIF etc. The number should always be 3 digits. Is this possible with GPRename? After an hour of experimenting and searching the net, I've so far not managed to do it. – Carl H Aug 05 '18 at 17:24
  • 1
    Open gprename and select the Numerical tab. Add numbers starting at 1 and incrementing by 1 and Insert before the numbers 00 and for the Keep existing names option select No. Click the Rename button. Select the Insert/Delete tab and insert London-04-Aug-2018- before the names of the files which have already been renamed to 001, 002, 003 and 004. – karel Aug 05 '18 at 20:35
  • 1
    This works just like ant-renamer with a couple fewer features Great alternative! – Bill Stidham Aug 14 '18 at 14:50
  • 1
    The pattern function in pyrenamer is much better than the solution needed in gprename. I'd like to have pyrenamer back. Great tool. – overkill22 Oct 31 '18 at 04:57
  • You must not have ever used PyRenamer. I tried gprename, and found it sadly lacking. It can't do anything requiring perl backreferences, such as changing part of a name that isn't constant, or deleting variable characters within a name, etc. The command line rename or pyrenamer are both much more powerful. – Marty Fried Oct 20 '19 at 20:14
  • 1
    I used PyRenamer exclusively for years until it was dropped from the default Ubuntu repositories in 18.04. – karel Oct 20 '19 at 20:24
6

I found a deb file here which seems to have installed ok in 18.04. So my normal service is resumed.
I used the deb file link at the bottom of this page which installed fine with double click. https://launchpad.net/ubuntu/+source/pyrenamer/0.6.0-1.2/+build/8439869

However, as helpfully suggested below a better and more comprehensive source of the deb is available on this page: https://packages.ubuntu.com/artful/all/pyrenamer/download

user824808
  • 319
  • 1
  • 4
  • 17
  • 1
    A better link would be this: https://packages.ubuntu.com/artful/all/pyrenamer/download So it doesn't link to the source but rather the .deb to install the package. As you can see the link is for artful, so it should work fine on Bionic. Maybe you should change your answer, and explain/link to how to install the .deb – Felipe May 08 '18 at 03:18
  • @user824808, you should mark this as answer. Installed on Linux Mint 19 with no problem using the deb file. – overkill22 Oct 31 '18 at 05:03
  • 1
    The second link gave me an error "two or more packages specified (pyrenamer artful)" – Marty Fried Oct 20 '19 at 20:18
  • This link works: https://packages.ubuntu.com/xenial/all/pyrenamer/download – Sarke Nov 15 '19 at 03:24
  • Then run with python2 /usr/bin/pyrenamer if your system defaults to Python 3, which won't work. – Sarke Nov 15 '19 at 03:27
  • After installing Ubuntu 20.04 I came to this answer to check if pyrenamer would still work if manually installed but sadly it didn't. Any idea how to get it to work on? – Felipe May 04 '20 at 18:49
0

I like using pyrenamer because it is so easy and does not involve any tricky coding. As explained above, it is good for easily renaming images with the day of the week. But it does not handle EXIF data for mts movies shot with my "dmc-gx7" camera so I was persuaded by seeing:

https://stackoverflow.com/questions/25152995/linux-shell-renaming-files-to-creation-time 

to getting my hands slightly dirty with EXIFTOOL and the ideas from the linked page to bulk rename with a script to get the day of the week and MY camera model into mts video file names. A variation can handle jpgs. See:

for f in *.mts
do
mv -n "$f" "$(exiftool -d "%Y%m%d_%a_%H%M%S" -DateTimeOriginal "$f" | awk '{print $4"_dmc-gx7~"}')"$f""
done
ls | while read upName; do loName=`echo "${upName}" | tr '[:upper:]' '[:lower:]'`; mv "$upName" "$loName"; done

The latter part switches to lower case and I forget where I found that trick. I'm a newbie so this was several hours work to achieve.

Carl H
  • 6,181
  • 6
  • 27
  • 41
user824808
  • 319
  • 1
  • 4
  • 17
0

Before upgrading to bionic I used PyRenamer and was very pleased with it, alternatives such as those mentioned above just did not cut it, so today I tried out Ant Renamer with Wine 3.0.2 and to my delight it worked just fine ; even easier to use than PyRenamer. Here is the download link (I downloaded the installer): https://www.fosshub.com/Ant-Renamer.html

0

I just installed it under xubuntu 18.04 I used the bottom link under built files on the web page below. Works fine.

https://launchpad.net/ubuntu/+source/pyrenamer/0.6.0-1.2/+build/8439869

FloT
  • 2,326
0

I still use pyrenamer for adhoc tasks because it is so easy and powerful. But there is now a better tool for my original requirement raised above of bulk renaming new photos and videos with "day of the week" included along with date, time taken and camera used.

Rapid Photo Downloader has added the feature for dotw. I should have preferred an option for all lower case such as "mon" instead of "Mon". But I can live with it as is and adding a switch to lower case to my photo workflow is not difficult but not worth the effort to change just one character.

For videos, it does not rename with the camera model but I can live without that too. I can easily bulk rename with nautilus using a right click.

I really like RPD because it is really fast and can automatically add a backup copy during the download. I send this to an external HDD. I then work with confidence on the imported photos/videos and reformat the camera SD card in the knowledge that if I make a mistake, there is a backup.

user824808
  • 319
  • 1
  • 4
  • 17