Nautilus script to perform one operation on multiple selected files?
1
vote
2
answers
722
views
I have a Nautilus script that I would like to modify so it performs a single operation using multiple selected files as input. Can someone please explain how to achieve this?
I tried
command $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
and what the script does is execute command file1
, then command file2
as two discrete operations. That doesn't work for my use case, instead I need the script to execute command file1 file2
.
If it matters, I am using it with the command align_image_stack
which needs 2 or more image files as input. I started Nautilus from a terminal to see error messages and I get *"align_image_stack: At least two files need to be specified"*. I've tested a few commands shown below, but all produce the same error message. I think the problem is the variable $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
produces newlines, but I don't know how else to capture selected file paths.
align_image_stack "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS"
align_image_stack $(echo "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS")
align_image_stack printf("$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS")
echo -n "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | xargs -I align_image_stack "{}"
Asked by Tom Brossman
(345 rep)
Jul 2, 2018, 08:16 PM
Last activity: Apr 16, 2025, 03:51 AM
Last activity: Apr 16, 2025, 03:51 AM