New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus • Advice and insight from world-class Apple enthusiasts • Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Operating System General OS operation information and support

Delete command in Context Menu


Post Reply New Thread Subscribe

 
Thread Tools
Gren

 
Member Since: Jun 24, 2011
Posts: 125
Gren is on a distinguished road

Gren is offline
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 by Gren; 05-19-2014 at 12:59 PM. Reason: Grammar
QUOTE Thanks
cradom

 
cradom's Avatar
 
Member Since: Feb 14, 2004
Location: Nederland, Texas
Posts: 3,086
cradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant future
Mac Specs: 21in iMac core2 Duo- 13in macbook - 10.9 on both

cradom is offline
Add an i switch and remove the f switch in the rm command.
rm -ir "$f"
Makes it ask for confirmation.

Craig Domingue - resident redneck.
“Never argue with an idiot. He will only bring you down to his level and beat you with experience.”, George Carlin
QUOTE Thanks
Gren

 
Member Since: Jun 24, 2011
Posts: 125
Gren is on a distinguished road

Gren is offline
Quote:
Originally Posted by cradom View Post
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.
QUOTE Thanks
cradom

 
cradom's Avatar
 
Member Since: Feb 14, 2004
Location: Nederland, Texas
Posts: 3,086
cradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant future
Mac Specs: 21in iMac core2 Duo- 13in macbook - 10.9 on both

cradom is offline
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?

Craig Domingue - resident redneck.
“Never argue with an idiot. He will only bring you down to his level and beat you with experience.”, George Carlin
QUOTE Thanks
Gren

 
Member Since: Jun 24, 2011
Posts: 125
Gren is on a distinguished road

Gren is offline
Quote:
Originally Posted by cradom View Post
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
QUOTE Thanks
cradom

 
cradom's Avatar
 
Member Since: Feb 14, 2004
Location: Nederland, Texas
Posts: 3,086
cradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant future
Mac Specs: 21in iMac core2 Duo- 13in macbook - 10.9 on both

cradom is offline
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.

Craig Domingue - resident redneck.
“Never argue with an idiot. He will only bring you down to his level and beat you with experience.”, George Carlin
QUOTE Thanks

Post Reply New Thread Subscribe


« Mac screen issue | Not enough memory »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Newer 5c won't let me delete emails PLUMMER iPhone Hardware and Accessories 3 05-30-2014 09:36 AM
Edit secondary click drop-down menu? MBP17•David OS X - Operating System 5 04-25-2014 10:37 AM
I would like a menu on a DVD for 3 videos ? timmy_toad Movies and Video 13 04-20-2014 07:12 PM

All times are GMT -4. The time now is 04:02 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?