[Question] How to setup bulk rename in NEMO?

Questions about applications and software
Forum rules
Before you post please read how to get help
Locked
highwind
Level 2
Level 2
Posts: 66
Joined: Tue Jan 07, 2014 4:25 pm

[Question] How to setup bulk rename in NEMO?

Post by highwind » Sat Mar 15, 2014 2:11 pm

Code: Select all

[Nemo Action]
Active=true
Name=pyRenamer
Exec=pyrenamer %P
Icon-Name=pyrenamer
Comment=rename multiple files
Selection=m
Extensions=any;
the above can be set up as nemo-action for multiple file rename by using pyrenamer

but does anyone know how to setup bulk rename function here in NEMO, see pic below:
bulk-rename.png
Nemo-Actions(learn from Thunar)http://docs.xfce.org/xfce/thunar/custom-actions
my unsolved posts:
47&t=162435
47&t=168608
211&t=170628
47&t=170642
90&t=170629

mattst
Level 1
Level 1
Posts: 24
Joined: Fri Oct 18, 2013 5:10 am

Re: [Question] How to setup bulk rename in NEMO?

Post by mattst » Wed May 07, 2014 1:45 pm

I found your post with a web search trying to solve the same problem.

The 'Bulk Rename - command to invoke' in Nemo Edit-->Preferences-->Behaviour is not usable. Using 'thunar --bulk-rename %F' works only if none of the file paths contain a space character. When using a Nemo Action a quote character can be specified so that filenames/paths containing spaces can be handled correctly but with Nemo Preferences there appears to be no way to specify to enclose the file paths of the selected files in double quotes.

My own Nemo Action solution is similar to yours but instead of using pyRenamer it uses 'thunar --bulk-rename' which I think is a better solution: only files that were selected are shown, no directory tree, dynamic preview (always displayed), and regex support in search/replace. The first of these reasons is the most important as pyRenamer can not be given a list of the files you want to rename, it can only take only a directory and you must highlight the files you wish to rename using the pyRenamer interface once it has loaded. Using 'thunar --bulk-rename' with my Nemo Action (below) only the files you have selected in Nemo are shown by the bulk rename GUI.

In case you don't know, Thunar is a file manager. I only have it installed for it's '--bulk-rename' option which brings up the bulk rename window without loading the file manager itself (which I never use). My only criticism of it is that it does not store your window resizing preferences between invocations.

Code: Select all

sudo apt-get install thunar
My 'thunar --bulk-rename' Nemo Action file is here:

Code: Select all

# File: /home/username/.local/share/nemo/actions/thunar_bulk_rename.nemo_action
# Nemo Action to facilitate bulk renaming of selected files.
# The file manager 'thunar' must be installed for its '--bulk-rename' facility.
# Install Thunar with: sudo apt-get install thunar

[Nemo Action]
Name=Bulk Rename
Comment=Bulk rename selected files
Exec=thunar --bulk-rename %F
Icon-Name=thunar
Selection=notnone
Extensions=any;
Quote=double
Note: The use of 'Quote=double' means that filenames containing spaces or single quote characters can be renamed, but that filenames with double quote characters can not be - not a problem for me as I never use double quotes in filenames.

Hope this helps.
Last edited by mattst on Thu May 08, 2014 6:09 am, edited 4 times in total.

highwind
Level 2
Level 2
Posts: 66
Joined: Tue Jan 07, 2014 4:25 pm

Re: [Question] How to setup bulk rename in NEMO?

Post by highwind » Wed May 07, 2014 11:22 pm

@mattst
thanks for introducing thunar, 12M make selection mean something, good work!
Nemo-Actions(learn from Thunar)http://docs.xfce.org/xfce/thunar/custom-actions
my unsolved posts:
47&t=162435
47&t=168608
211&t=170628
47&t=170642
90&t=170629

mattst
Level 1
Level 1
Posts: 24
Joined: Fri Oct 18, 2013 5:10 am

Re: [Question] How to setup bulk rename in NEMO?

Post by mattst » Thu May 08, 2014 4:38 pm

mattst wrote:The 'Bulk Rename - command to invoke' in Nemo Edit-->Preferences-->Behaviour is not usable. Using 'thunar --bulk-rename %F' works only if none of the file paths contain a space character.
I had another look at this today and wrote a very simple Bash script to see what is sent to the Edit-->Preferences-->Behaviour 'Bulk Rename - command to invoke' (hereafter bulk command) by Nemo.

Code: Select all

#!/bin/bash

echo $@ > /home/user/Temp/TestBulkRename/arglist
It looks to me like spaces in the file paths are replaced by zeros when they are sent to the bulk command, unless I'm very much mistaken.

Code: Select all

Bulk command == /Path/To/BashScriptAbove %F

Files selected in Nemo:

/home/user/Temp/TestBulkRename/TestBulkRename-1
/home/user/Temp/TestBulkRename/TestBulkRename-2
/home/user/Temp/TestBulkRename/TestBulkRename-3

Output:

file:///home/user/Temp/TestBulkRename/TestBulkRename-1 file:///home/user/Temp/TestBulkRename/TestBulkRename-2 file:///home/user/Temp/TestBulkRename/TestBulkRename-3

Files selected in Nemo:

/home/user/Temp/TestBulkRename/Path With Spaces In It/Test Bulk Rename-1
/home/user/Temp/TestBulkRename/Path With Spaces In It/Test Bulk Rename-2
/home/user/Temp/TestBulkRename/Path With Spaces In It/Test Bulk Rename-3

Output:

file:///home/user/Temp/TestBulkRename/Path0With0Spaces0In0It/Test0Bulk0Rename-1 file:///home/user/Temp/TestBulkRename/Path0With0Spaces0In0It/Test0Bulk0Rename-2 file:///home/user/Temp/TestBulkRename/Path0With0Spaces0In0It/Test0Bulk0Rename-3
I would say it looks like a bug to me but I downloaded the Nemo source and had a look at the bulk rename code, I followed it as far as 'g_file_get_uri' (which is a call to the GTK library and no longer part of the code written for Nemo) and could not see anthing which would swap a space for a 0. It's truly very strange indeed - I suppose I am overlooking something... if anyone knows what then I'd love to know.

'thunar --bulk-rename %F' can not cope with unquoted uris which contain spaces in the 'file:///path with/spaces in' form anyway (I tested that as well). But if it wasn't for the space to 0 translation a script could be written to sort it out. Not that this matters much as my Nemo Action file works just fine.

Paper Bag
Level 1
Level 1
Posts: 17
Joined: Fri Dec 31, 2010 1:20 pm

Re: [Question] How to setup bulk rename in NEMO?

Post by Paper Bag » Fri Mar 20, 2015 12:58 pm

Thank you mattst. Other than missing F2 press, this is pretty much ideal and replicates old nautilus-renamer functionality. Thunar's renamer is also pretty similar to that in simplicity.

Nemo team should just fork the Thunar code and make it a built in feature. :P

mattst
Level 1
Level 1
Posts: 24
Joined: Fri Oct 18, 2013 5:10 am

Re: [Question] How to setup bulk rename in NEMO?

Post by mattst » Sat Mar 21, 2015 11:48 am

Paper Bag wrote:Thank you mattst. Other than missing F2 press, this is pretty much ideal and replicates old nautilus-renamer functionality. Thunar's renamer is also pretty similar to that in simplicity.

Nemo team should just fork the Thunar code and make it a built in feature. :P
I'd like them to fork the "thunar --bulk-rename" dialog and add code so that it remembers its size between uses. I downloaded the source and found the initial size code so that I could at least set it to a sensible size. But I gave up trying to compile it after 15 mins, I'm not going to spend hours to do something that only takes me a few seconds even if it is every time I use the rename dialog (which is quite often).

Paper Bag
Level 1
Level 1
Posts: 17
Joined: Fri Dec 31, 2010 1:20 pm

Re: [Question] How to setup bulk rename in NEMO?

Post by Paper Bag » Sat Mar 21, 2015 12:56 pm

mattst wrote:
Paper Bag wrote:Thank you mattst. Other than missing F2 press, this is pretty much ideal and replicates old nautilus-renamer functionality. Thunar's renamer is also pretty similar to that in simplicity.

Nemo team should just fork the Thunar code and make it a built in feature. :P
I'd like them to fork the "thunar --bulk-rename" dialog and add code so that it remembers its size between uses. I downloaded the source and found the initial size code so that I could at least set it to a sensible size. But I gave up trying to compile it after 15 mins, I'm not going to spend hours to do something that only takes me a few seconds even if it is every time I use the rename dialog (which is quite often).
Try gdevilspie.

alexdd
Level 1
Level 1
Posts: 22
Joined: Wed Jun 03, 2015 2:10 pm

[SOLVED] How to setup bulk rename in NEMO

Post by alexdd » Fri Jun 26, 2015 7:04 pm

it worked using https://wiki.archlinux.org/index.php/Nemo
and this
mattst wrote:I found your post with a web search trying to solve the same problem.

The 'Bulk Rename - command to invoke' in Nemo Edit-->Preferences-->Behaviour is not usable. Using 'thunar --bulk-rename %F' works only if none of the file paths contain a space character. When using a Nemo Action a quote character can be specified so that filenames/paths containing spaces can be handled correctly but with Nemo Preferences there appears to be no way to specify to enclose the file paths of the selected files in double quotes.

My own Nemo Action solution is similar to yours but instead of using pyRenamer it uses 'thunar --bulk-rename' which I think is a better solution: only files that were selected are shown, no directory tree, dynamic preview (always displayed), and regex support in search/replace. The first of these reasons is the most important as pyRenamer can not be given a list of the files you want to rename, it can only take only a directory and you must highlight the files you wish to rename using the pyRenamer interface once it has loaded. Using 'thunar --bulk-rename' with my Nemo Action (below) only the files you have selected in Nemo are shown by the bulk rename GUI.

In case you don't know, Thunar is a file manager. I only have it installed for it's '--bulk-rename' option which brings up the bulk rename window without loading the file manager itself (which I never use). My only criticism of it is that it does not store your window resizing preferences between invocations.

Code: Select all

sudo apt-get install thunar
My 'thunar --bulk-rename' Nemo Action file is here:

Code: Select all

# File: /home/username/.local/share/nemo/actions/thunar_bulk_rename.nemo_action
# Nemo Action to facilitate bulk renaming of selected files.
# The file manager 'thunar' must be installed for its '--bulk-rename' facility.
# Install Thunar with: sudo apt-get install thunar

[Nemo Action]
Name=Bulk Rename
Comment=Bulk rename selected files
Exec=thunar --bulk-rename %F
Icon-Name=thunar
Selection=notnone
Extensions=any;
Quote=double
Note: The use of 'Quote=double' means that filenames containing spaces or single quote characters can be renamed, but that filenames with double quote characters can not be - not a problem for me as I never use double quotes in filenames.

Hope this helps.

wujastyk
Level 1
Level 1
Posts: 8
Joined: Sun Oct 05, 2014 12:56 pm

Re: [Question] How to setup bulk rename in NEMO?

Post by wujastyk » Sat Apr 22, 2017 12:45 am

Code: Select all

[Nemo Action]
Name=Bulk Rename
Comment=Bulk rename selected files
Exec=thunar --bulk-rename %F
Icon-Name=thunar
Selection=notnone
Extensions=any;
Quote=double
This is great, but the semicolon after "Extensions=any;" means the action stops there, and "Quote=double" never gets read, so spaces remain a problem. Just move the semicolon to the end, after "double".

User avatar
bernd.wechner
Level 3
Level 3
Posts: 106
Joined: Sat Sep 05, 2015 6:22 am

Re: [Question] How to setup bulk rename in NEMO?

Post by bernd.wechner » Sun Sep 02, 2018 6:05 am

Seems to me much of the advice here is dated. I struggled making nay of it work. Am on Mint 19. I had it working on mint 18, but forgot how ;-). Anyhow it turns out that it works fine on Mint 19, just that you have leave the %F off the thunar command line when configuring nemo. In other words, install thunar, then on the menu edit > preferences > behaviour > bulk rename, enter just

Code: Select all

thunar --bulk-rename
and it all works fine. On a Mint 19 install anyhow.

User avatar
Pierre
Level 19
Level 19
Posts: 9147
Joined: Fri Sep 05, 2008 5:33 am
Location: Perth, AU.

Re: [Question] How to setup bulk rename in NEMO?

Post by Pierre » Sun Sep 02, 2018 7:01 am

Yep - much of the advice here is dated ..

it's an old thread, that may not always be of relevance,
as the later operating systems, have moved on.
:)

Do Tread Carefully, when using any information, in these older threads.
Image
Please edit your original post title to include [SOLVED] - when your problem is solved!
and DO LOOK at those Unanswered Topics - - you may be able to answer some!.

Locked

Return to “Software & Applications”