0

i am a mac user. and i want to remove a folder of my desktop by double clicking any file. (just like uninstaller).

So, Without using Terminal or manually delete , i want to remove that folder by creating a file. so when i double click on that file, it automatically remove a folder of my desktop.

Brad Lanam
  • 5,192
  • 2
  • 19
  • 29
PJR
  • 13,052
  • 13
  • 64
  • 104

1 Answers1

1

If you have a specific folder to delete, you can write a sh file.

my-remove.sh:

rm -rf /path/to/your/folder

please don't forget to execute chmod on it:

chmod a+x my-remove.sh

Then you can remove /path/to/your/folder when you double click my-remove.sh

EDIT:

I'll sum it here.

1, Open Terminal in mac

2, cd ~/Desktop

3, touch my-remove.sh

4, echo "rm -rf /path/to/your/folder" > my-remove.sh

5, chmod a+x my-remove.sh

Then you can see a my-remove.sh file on your desktop, double-clicking it would remove /path/to/your/folder

EDIT AGAIN:

Sorry, seems that only chmod is not enough, please see this post

Community
  • 1
  • 1
shengy
  • 9,461
  • 4
  • 37
  • 61
  • how can i create .sh file ? – PJR Nov 06 '13 at 08:17
  • `touch my-remove.sh`, or, righ click on the desktop and select create new file? I don't have a mac right now, so this is just guessing:) – shengy Nov 06 '13 at 08:18
  • once you created a file, you can edit it with any editor you like, textedit is ok. – shengy Nov 06 '13 at 08:20
  • Or if you really don't want to use an editor, use the following command to write in you `sh` file. `echo "rm -rf /your/folder" > my-remove.sh` – shengy Nov 06 '13 at 08:23
  • run `touch my-remove.sh` in Terminal to create your `sh` file – shengy Nov 06 '13 at 08:23
  • okay i get it.. but for that i have to drag that file into terminal , can i do it by double click ? – PJR Nov 06 '13 at 08:32
  • I don't have a mac by my side right now, but I think double-click on the file will work after you use the `chmod` command. – shengy Nov 06 '13 at 08:33