1

I am trying to add a custom command to Nemo (Linux Mint). I have the following script I've been running via the terminal (by manually changing directories):

ls | cat -n | while read n f; do mv "$f" "$n.jpg"; done

The desire is to take every file in a folder (all images) and mass rename them, in sequential order (1.jpg, 2.jpg, etc.). It's cumbersome to open terminal into each folder and then run the command, etc so I want to add a custom command to Nemo. I have tried the following .nemo_action:

    [Nemo Action]

Name=Sequential Rename

Comment=Sequentially Rename All Files In Folder

Exec=ls | cat -n | while read n f; do mv "$f" "$n.jpg"; done

Icon-Name=Terminal

Selection=s

Extensions=dir;

Unfortunately, what has happened is that the command seems to be run in my username's folder, renaming my Documents, Music, Videos, Pictures, and Downloads folders into 1.jpg, 2.jpg, etc.

Does anyone have a solution to this? Ideally, I want to right click on a folder and press this action button to have it run.

0

I found it easier to have the nemo action call a separate script. So, create a CustomScript.sh file with your actions in it, then just have your nemo custom action call the script. You can pass the folder name into the script.

So your nemo action will have the line: Exec=CustomScript.sh %F

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.