Newbies enorris Posted April 27, 2013 Newbies Posted April 27, 2013 Okay... I am trying to remove a file using a calculated Path. Here is what I have so far. I have gotten the below Shell Script to work. "try¶ do shell script "rm -r /Users/en/desktop/dropbox/pip/Labels/FMFiles/Cable2.fmp12"¶ end try" What I am trying to get working is the Path of the File automated. The Filed below has the correct Path of the file. I don't get any errors when this runs. try¶ do shell script "rm -r _MASTER::FilePath & 'Cable2.fmp12'"¶ end try" Where am I going wrong? Thanks, ERIC
Karsten Wolf Posted April 27, 2013 Posted April 27, 2013 Try this. I have not tested it but it corrects some of the mistakes you made. The script assumes that _MASTER::FilePath ends with a "/". You might want to take a look at the ScriptMaster plug-in. It is better suited for such tasks. "try¶" & "do shell script "rm -r " & _MASTER::FilePath & "Cable2.fmp12"¶" & "end try"
IdealData Posted April 27, 2013 Posted April 27, 2013 Here's a little trick... You can export an empty container - this will delete the target file!! Although the script will say "Container fields cannot be exported" the target file gets removed anyway.
Newbies enorris Posted April 27, 2013 Author Newbies Posted April 27, 2013 Try this. I have not tested it but it corrects some of the mistakes you made. The script assumes that _MASTER::FilePath ends with a "/". You might want to take a look at the ScriptMaster plug-in. It is better suited for such tasks. "try¶" & "do shell script "rm -r " & _MASTER::FilePath & "Cable2.fmp12"¶" & "end try" Karsten, I tried the above script and no go... Any other ideas??
Karsten Wolf Posted April 27, 2013 Posted April 27, 2013 2 ideas: - replace the '-r' with '-f' - you don't want to delete whole folders accidentally. - make a script with 1 SetVar statement or a calculated result field which contains just the code I posted first. Execute it in the context of the _MASTER table and post the result.
Newbies enorris Posted April 28, 2013 Author Newbies Posted April 28, 2013 I found a solution. I had played around with the ScriptMaster Plugin a while back and for reason couldn't get it to work. This time around the ScriptMaster worked. I did have to set a Variable for the File Path. Thanks for the help!!
Recommended Posts
This topic is 4226 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now