Tip Of The Day (4) : Bulk renaming files in linux
Don't forget to read the other tips:
- Xfce with Thunar : use the embedded Bulk renamer included in Thunar.
- Linux Mint with Nemo (or Ubuntu based with Nautilus) :
1- Install pyrenamer
2- Use it "as it is" or integrate it in your file manager :
Nautilus and its fork, Nemo can use scripts to integrate new features.
to get the right folder for your script, use either solutions :
- Right click on a file, search for scripts > open scripts folder
- On Nautilus for Ubuntu 12.10 and before : ~/.gnome2/nautilus-scripts
- On Nautilus for Ubuntu 13.04 and after : ~/.local/share/nautilus/scripts
- On Nemo : ~/.gnome2/nemo-scripts
Create a new file call it "Bulk rename" or whatever, open it with your text editor and paste the following :
#!/bin/bash
#Launch Pyrenamer in current folder.
#########################################################################
# Nemo "Bulk Rename" Script #
##########################################################################
if [ "$1" = "" ];then
wdir=${NEMO_SCRIPT_CURRENT_URI#file://}
wdir=${wdir//%20/ }
else
filetype=$(file "$1")
filetype=${filetype##*: }
if [ "$filetype" = "directory" ];then
wdir=${NEMO_SCRIPT_SELECTED_FILE_PATHS%%$1*}
wdir=$wdir/$1
else
wdir=${NEMO_SCRIPT_SELECTED_FILE_PATHS%%$1*}
fi
fi
pyrenamer "$wdir"
Save, and make it executable
3- the script is now available when right clicking > scripts in the folder you want files to be renamed.