Problem with DeleteFile> ,relative path and wildcard

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
rullbandspelare
Pro Scripter
Posts: 149
Joined: Tue Mar 23, 2004 9:11 pm

Problem with DeleteFile> ,relative path and wildcard

Post by rullbandspelare » Mon Apr 16, 2007 7:24 am

The help file say that * can be used with DeleteFile>
I cant get it to work as i want to with a relative path.

Does NOT work:
DeleteFile>..\lock\DICOM*.lock

WORKS:
DeleteFile>C:\Program\MJT Net Ltd\lock\DICOM*.lock
DeleteFile>..\lock\DICOM_196605194353.lock

Help!
Thanks!
/tomas

User avatar
Captive
Macro Veteran
Posts: 213
Joined: Sun Oct 20, 2002 8:37 pm
Location: Colorado, USA

Post by Captive » Mon Apr 16, 2007 9:26 pm

Let>VAREXPLICIT=1
MessageModal>SCRIPT_DIR is %SCRIPT_DIR%%CRLF%CWD is %CWD%
DeleteFile>..\deleteme.txt
DeleteFile>..\test\deleteme.txt

Both worked. The files are currently relative to %CWD%
v9.0.054

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon Apr 16, 2007 10:01 pm

I agree that if you try to delete from a relative directory and you use an explicit file name, the file deletes correctly as in Captive's example. However, I agree with tomas that the files do not delete if a wildcard (*) is used

Here is a workaround if you have not already found one.

Code: Select all

Separate>%CWD%,\,dir
Sub>dir_count,1
Let>k=0
Let>newpath=
Repeat>k
  add>k,1
  let>value=dir_%k%
  Concat>newpath,%value%\
Until>k=%dir_count%

DeleteFile>%newpath%DICOM*.lock

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts