Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 4226 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted

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

Posted

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"
Posted

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
Posted

 

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??

Posted

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
Posted

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!!

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.