Skip to main content
Question

Need to delete file using casper

  • September 11, 2012
  • 6 replies
  • 0 views

Forum|alt.badge.img+3

I ma trying to delete a directory from /Library/Application Support/iLifeMediaBrowser

-Is there a way to accomplish this with jss. Do I need a script? If yet, does anyone have example?

6 replies

Forum|alt.badge.img+20
  • Valued Contributor
  • 732 replies
  • September 11, 2012

Simple script will work

#!/bin/sh
rm -R "/yourdirectory"

Upload Script to Casper Admin
Create a Policy Set the target group
Set your trigger


Forum|alt.badge.img+3
  • Author
  • New Contributor
  • 4 replies
  • September 11, 2012

not working
i get this error

/usr/sbin/jamf is version 8.6
Executing Policy Run Script iLifeFix.sh...
Creating directory structure for /Library/Application Support/JAMF/Downloads/
Downloading http://zeus.gowerschools.org:80/CasperShare/Scripts/iLifeFix.sh...
Running script iLifeFix.sh...
Script exit code: 2
Script result: /private/tmp/iLifeFix.sh: line 1: {rtf1ansiansicpg1252cocoartf1038cocoasubrtf360: command not found
/private/tmp/iLifeFix.sh: line 2: syntax error near unexpected token `}'
/private/tmp/iLifeFix.sh: line 2: `{fonttblf0fnilfcharset0 Calibri;f1fmodernfcharset0 Courier;}'

My script look like this:

#! /bin/sh
rm -rf "/Volumes/Macintosh_HD/Library/Application Support/iLifeMediaBrowser/"


Forum|alt.badge.img+31
  • Honored Contributor
  • 2721 replies
  • September 11, 2012

Hi Everyone,

You can just run a command in a policy in the advanced tab to use the rm command to remove a directory. So, in the JSS, create a policy and have the policy do nothing, but on the advanced tab there is a run command box. In that box input your command. No script needed.

Just be careful you are doing the right thing as once you scope the policy to production there is no turning back.

Hope that helps,
Tom


mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • September 11, 2012

Your shebang is set up wrong if that is how your script actually looks. Should be

#!/bin/sh

You have a space in there.

But to make this easier, use either Casper Remote or a policy with the Run Command field under Advanced with something like-

rm -R /Library/Application Support/iLifeMediaBrowser

For one liners like that there is no need to create and upload a whole script.


Forum|alt.badge.img+31
  • Honored Contributor
  • 2721 replies
  • September 11, 2012
My script look like this: #! /bin/sh rm -rf "/Volumes/Macintosh_HD/Library/Application Support/iLifeMediaBrowser/"

You have a space in your shebang, should be #!/bin/sh or #!/bin/bash

Hope this fixes your problem,
Tom


Forum|alt.badge.img+3
  • Author
  • New Contributor
  • 4 replies
  • September 12, 2012

Thank You...I used the Run Command in the Advanced options. Works great


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings