Subscribe Bookmark RSS Feed

Delete Directory() does not work with Include() ?

djhanson

Community Trekker

Joined:

Jun 23, 2011

This is really odd...I have a JSL that will Include() another JSL that tries to do a Delete Directory() on a local path on my PC.  I'm greatly simplifying why I have to do it this way for the sake of this problem here.  In this case I need the script to do the deleting automatically (I cannot do this manually for the sake of my application).

JSL1.jsl:
//!
Include("C:\mypath\JSL2.jsl");

JSL2.jsl:

Delete Directory("C:\mypath\mysubpath");

Initiating JSL1: does not work...the directory does not get deleted.  The script is auto-started.

Initiating JSL2 with Running Man ("Run Script" button): works...the directory does get deleted.  This of course brings it into the script window as I'm running it manually.

Very odd.  And the same issue with Copy Directory().

Any reasons why this doesn't seem to work?  Are there certain actions that will not execute with an Auto-Start (//!) and an Include() statement?  thanks, DJ

2 REPLIES
Craige_Hales

Staff

Joined:

Mar 21, 2013

my quick test says it works on win7.  The junk2 folder disappears when I double-click JSL1.jsl to launch JMP.  Is there any hint in the log window?

10609_delete.png

Craige
msharp

Super User

Joined:

Jul 28, 2015

This works on my computer as well. 

Which leads me to ask the basic troubleshooting questions: Did you check spelling?  Referencing the correct file path (not an old file path)?  You won't be able to delete a directory if any of the files in it are locked.  Does the mysubpath contain either of the scripts you are running?  Ect. Ect.