Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Let's say your work situation isn't going so well, and you suspect the end is near.

How would you prepare a script (or similar) to remove your personal files and applications from your work computer (OSX Lion) if you only had a few minutes to gather your things and leave the building? Of course, you want to leave the machine functional, and all your work files intact, because the situation is bad but you aren't a jerk.

share|improve this question
Can I assume that means deleting your user account? Or do you have separate files in separate locations which you would like to delete? – duci9y Sep 19 '12 at 17:31
Deleting the user account isn't an option. This is a small shop and it's likely that the user account (along with relevant work documents and installed apps) will be used by the replacement employee, just renamed. – ironsolo Sep 19 '12 at 17:46
If you are allowed to gather your things that does not mean (and if employer is savvy definitely not) that you can touch the computer. Alos they will be on the companies backups - so assume you cannot – Mark Sep 22 '12 at 13:24
up vote 1 down vote accepted
  1. Follow this guide to create a simple file path copier.

  2. Open a new document in TextWrangler. Paste in the following:

    rm -rf 

    Note the space after rm -rf.

  3. Open Finder, go to a file, press the keyboard shortcut you assigned in step 1, then press ⌘ cmd + V in TextWrangler.

  4. Do this for all the files you want deleted. Make sure there is a space between two file paths and not an enter. That means all the file paths will be on the same line. Also, if there are any spaces in the file path, you need to enclose the path in quotes ('/path/with a space' or "/path/ with a space").

  5. Save the file on the Desktop with the name Don’t check any other options while saving.

  6. Make the script executable by typing in Terminal sudo chmod 755 ~/Desktop/

  7. When D-Day comes, right click on the file, select Open With → Other…. Open the Applications → Utilities folder, in the Enable: field, select “All Applications.”

  8. Double click on Terminal.

  9. The script will finish its job in a few minutes.

Alternatively, you can open the file in Text Wrangler and copy and paste the contents in Terminal. This eliminates steps 6 and 7.

share|improve this answer
re 4. and the file paths must be in the same line as "rm -rf" ? – what Sep 19 '12 at 18:33
Perfect. I ran a test and I had to make the script executable by doing a chmod 755 before it could run. – ironsolo Sep 19 '12 at 21:45
Glad I could help you. @what I don’t understand what you mean by that. – duci9y Sep 20 '12 at 6:29
I mean is it "rm -rf path/to/file" or "rm -rf\r\n/path/to/file"? You describe the process as if the paths have to go on a new line, but I would have expected the paths to go on the same line as the remove command. So where should they go? – what Sep 20 '12 at 18:38
You can make a shell script auto open in Terminal by saving it with a .command suffix. So in this case, Steps 7-9 could be replaced with "Double-click on anything.command to run the script.". – Brian LaShomb Dec 14 '12 at 15:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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