Nemo Bulk rename

Anyone having problems with this closing when several files are picked for rename?
Used to work fine.

Did you install something to-do bulk renames? If so - from where did you install it?

Hi I had installed gprename when I went to nemo preferences and changed rename behaviour from gprename to gprename %1 it stays open.
Well I never! anyway, sorted thanks.

ubuntu-bug gprename:
GPrename unable to accept multiple file parameters
Behaviour is accurately reported elsewhere:
https://forums.linuxmint.com/viewtopic.php?t=222665

I find exactly the same; multiselect files from nemo/bulk rename and a random file from anywhere is displayed. Also, if in nemo, action is described as gprename only, gui is instantiated, then self closes. action must be as gprename %1 or gprename %F (parameter needed).
With any parameter the behaviour is the same; no files selected are shown.

I have uninstalled and reinstalled to no avail.

I have uninstalled and replaced with krename which works perfectly with nemo with no parameters necessary.
Thanks, Alistair.

The bug report should be on the upstream tracker since no-one will monitor bugs on launchpad for this app

https://sourceforge.net/p/gprename/bugs/

I note that there was a release made late last year by that upstream - looks like no one from Debian packaged it :frowning:

cheers Foss; done and dusted

Just reading on the Debian bug reports - a bug report was made asking to be updated to the latest back in 2017 - but no response.

Seems the current Debian maintainer … isnt maintaining it anymore :frowning:

Sounds like the caja-rename script needs to be massaged to work with Nemo then. I just noticed also the maintainer has renamed himself.

Script here I claim no originality its simple, and works:
Ensure its executable, in nemo behaviour put /usr/local/bin/bulk-rename.sh
Regards,
Al.

#!/bin/bash
# Run this script by setting it at:
# Nemo -> Edit -> Preferences -> Behavior -> Bulk Rename
# Select multiple files in Nemo and hit F2 (or right-click -> Rename)

# Return the index of the first ocurrence of a substring or -1 if none
# $1 = string
# $2 = substring
function strindex() { 
  x="${1%%$2*}"
  [[ "$x" = "$1" ]] && echo -1 || echo "${#x}"
}

# Convert '+' to ' ' and '%20' to ' '
# $1 = string to decode
function urldecode() {
    : "${*//+/ }"; echo -e "${_//%/\\x}";
}

# Log to temporary file if enabled
function log() {
    echo $1 >> "/tmp/nemo-bulk-rename.log"
}

# Add index to string replacing placeholder if exists or at the end.
# $1 = string
# $2 = leadingCeroes
# $3 = index
function replaceCounter() {
    if [[ "$counterIndex" -eq "-1" ]];
    then
        echo "$1_$3";
    else
        printf -v index "%0$2d" $3
        echo ${1/"c:$2"/$index}
    fi
}

log "============ New bulk rename at `date '+%Y-%m-%d %H:%M:%S'` ============"

fileName=$(zenity --entry --title="Nemo - Bulk Rename" \
    --window-icon="info" \
    --text="Type new file name without extension ('/' is not allowed).\nUse c:n placeholder mask to specify counter position and amount of leading zeroes.\ni.e.:\n  'filename' = filename__1.ext  (no mask)\n  'my c:2 file' = my 01 file.ext")
if [[ -z "$fileName" ]] || [[ $fileName == *\/*  ]]; then
    notify-send "Bulk Rename: Error" "Please insert a valid file name." -i error -u low
    exit 0
fi

log "renaming files to: $fileName"
placeholder="c:"
counter=1
counterIndex=$(strindex "$fileName" "$placeholder")
leadingCeroes=${fileName:$counterIndex+2:1}

log "found placeholder at: $counterIndex for $leadingCeroes leading ceroes"
# loop throught files passed by Nemo
# paths come in the format "file:///home/user/.."
for i; do
    i=$(urldecode $i)
    # replace "file://" with ""
    oldPath=${i/"file://"/""}
    path="${oldPath%\/*}"
    ext=${oldPath##*.}
    newName="$path/$(replaceCounter "$fileName" "$leadingCeroes" "$counter").$ext"
    log "renaming $oldPath to $newName"
    mv "$oldPath" "$newName"
    counter=$((counter+1))
done
counter=$((counter-1))
notify-send "Bulk Rename: Completed" "Renamed $counter files successfully" -i nemo -u low
exit 0
1 Like

Or use Nautilus instead of Nemo ?

Only for that bulk-renaming feature I may prefer Nautilus over Nemo.

Is it possible to totally uninstall Nemo from UbuntuBudgie, and then have Nautilus as default ?

I know icons on desktop would have to be handled else way but there are acceptable workarounds for that.

Nemo works well enough for me.