Delete command in Context Menu

Joined
Jun 24, 2011
Messages
215
Reaction score
2
Points
18
Location
Brighton
I have a Run Shell Script workflow which adds a Delete command to the context menu.

for f in "$@"
do
rm -rf "$f"
done


I can't remember where I came by it but I want to add an "are you sure" confirmation request to the script. Can anyone help please?
 
Last edited:
Joined
Feb 14, 2004
Messages
4,781
Reaction score
166
Points
63
Location
Groves, Texas
Add an i switch and remove the f switch in the rm command.
rm -ir "$f"
Makes it ask for confirmation.
 
OP
Gren
Joined
Jun 24, 2011
Messages
215
Reaction score
2
Points
18
Location
Brighton
Add an i switch and remove the f switch in the rm command.
rm -ir "$f"
Makes it ask for confirmation.

Unfortunately that doesn't work, I get the "Trash" sound, the file remains undeleted and there's no confirmation request.
 
Joined
Feb 14, 2004
Messages
4,781
Reaction score
166
Points
63
Location
Groves, Texas
Odd. I make a dir with 3 files in it and tried to delete it with rm -ir and got this: (see pic)

It asked for each file in the dir.
Must need Terminal instead of Automator. That is how you're running it right?

Terminal — rm — 200×46 2014-05-19 16-08-08 2014-05-19 16-08-12.png
 
OP
Gren
Joined
Jun 24, 2011
Messages
215
Reaction score
2
Points
18
Location
Brighton
Odd. I make a dir with 3 files in it and tried to delete it with rm -ir and got this: (see pic)

It asked for each file in the dir.
Must need Terminal instead of Automator. That is how you're running it right?

Yes, I made an Automator workflow, Terminal's a mystery to me. I'll have another look tomorrow. It's bedtime here, I have an early yoga class tomorrow.

Thanks anyway and goodnight

Gren
 
Joined
Feb 14, 2004
Messages
4,781
Reaction score
166
Points
63
Location
Groves, Texas
Looks like you need to make some kind of loop in Automator to ask permission to delete for each file. I cant help with that because I don't know/use Automator.
Sorry.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top