Help with terminal !!

Posted:
in Genius Bar edited January 2014
hi all,



When im working on the pc servers at work my mac leaves loads of ._dsstore files along with loads of other crap starting with ._



i found a 'script' i could use with the terminal that will delete all these files.



It is:



cd /Volumes/PROJECTS

find . -name "._*" -exec rm '{}' \\; -print



and



cd /Volumes/INETPUB

find . -name "._*" -exec rm '{}' \\; -print



Im no expert with the terminal but it does work!



Now, is there a way i can have some kind of icon on my desktop that i can click to run this 'script'. It would save me having to type it in every morning! like i do now!



Cheers

Comments

  • Reply 1 of 3
    Be very careful about deleting those "loads of other crap starting with ._"! You might start finding that your data is unusable or unreadable on your Mac after deleting some ._* files.



    The ._ prefix is used to save the resource fork of a file on a non-HFS filesystem. Some older apps (notably Classic and a handful of old Carbon apps) still save data for files in the resource fork. In fact, all Classic apps and some Carbon apps themselves have resource forks that are absolutely necessary to run. Kill those files and you kill that data. It will be gone permanently.
  • Reply 2 of 3
    mark_lmark_l Posts: 39member
    thanks for that!! its mainly the dsstore file that i need to remove from the windows servers.
  • Reply 3 of 3
    thuh freakthuh freak Posts: 2,664member
    Quote:

    Originally posted by MARK_L

    thanks for that!! its mainly the dsstore file that i need to remove from the windows servers.



    it would probably be good for you to change your removal script to just get rid of those then.



    once you have a script, that sits well with you, copy and paste it into a new file (from textedit or some text editor). Save it as "your script name.command". TextEdit may append ".txt" or something onto the end, so in the finder make sure the file name ends in .command. Next you have to make the file 'executable'. Pop into terminal, cd to where you saved the script (for example, if its on your desktop, type 'cd ~/Desktop'). Then type "chmod +x 'your script name.command'" (without the double quotes, but with the singles). Then you can double click it. Doing that will open a new Terminal window which will run through the commands in the file, line by line.



    There is an alternative to .command files, if you really don't like terminal opening: 'cron'. cron is a special tool that executes commands on a schedule, so you could set it up to run your script once per day, several times a day, per month, at a certain hour/minute, and all kinds of permutations of hour/minute/day/day of week/month/... Setting it up isn't extremely difficult, but its kind of annoying for me to explain it. If you search through Genius Bar for 'cron' you'll probably find one or two times that I explained how to add a cron job for someone else.
Sign In or Register to comment.