Page 2 of 2 <12
Topic Options
#47031 - 2003-10-20 04:23 AM Re: DEL command not deleting read-only files
Everyone Offline
Getting the hang of it

Registered: 2003-10-19
Posts: 81
Loc: Beale Air Force Base, CA
So back to the original subject..

My solution based on kdyer and r2d2's suggestions, and my circumstances, is:

IF EXIST ("test.txt")
SETFILEATTR ("test.txt",128)
DEL "test.txt"
ENDIF

Which looks like the easiest way to do what I need to do.

Set the file attributes to normal, so the DEL command can delete it with ease. (the file I'm deleting has attributes that vary from system to system. There is no need to know the attributes of the file, hence no GETFILEATTR command)

Thanks all.

Top
#47032 - 2003-10-20 04:49 AM Re: DEL command not deleting read-only files
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
Here is the code with a little error or success checking. Should work fine for KiXtart 3.63

break on
$FileCheck='C:\TEMP\TEST.TXT'
if exist ($FileCheck)
? 'Found file : '
$SetAttrib=setfileattr($FileCheck,128)
? 'Setting file attrib was: '+@error+' '+@serror
del $FileCheck
? 'File deletion success was: '+@error+' '+@serror
else
? 'Unable to locate file '+$FileCheck
endif

Top
#47033 - 2003-10-20 05:20 AM Re: DEL command not deleting read-only files
Everyone Offline
Getting the hang of it

Registered: 2003-10-19
Posts: 81
Loc: Beale Air Force Base, CA
Thanks.

I don't have success/failure messages in the script this is being used in. I have it appending data to a log on a file server.

Currently success/failure is checked with a redundant IF EXIST command toward the end of the script.

I'll post the full script to the scripts forum some time tomorrow when I'm in the office.

It's currently 100% effective, I'm just looking to tweak it and make it more effecient.

Top
#47034 - 2003-10-20 03:51 PM Re: DEL command not deleting read-only files
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
quote:
I'm just looking to tweak it and make it more effecient
Then you should upgrade to KiXtart v4.21 [Wink]
_________________________
There are two types of vessels, submarines and targets.

Top
#47035 - 2003-10-20 09:54 PM Re: DEL command not deleting read-only files
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
quote:
quote:

I'm just looking to tweak it and make it more effecient

Then you should upgrade to KiXtart v4.21

LOL [Big Grin] but true.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#47036 - 2003-10-20 10:29 PM Re: DEL command not deleting read-only files
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Upgrading KiXtart (have used the the second link with "locked down" systems):

KiXtart Deployment

Re-Write of the KIX32.EXE Deployment tool

KiXtart FAQ & How to's

Alternatively, rather than distributing the KIX32.EXE/WKIX32.EXE file to the clients, you can run these on the Logon server. However, you have to change your client profiles from NTLOGON.BAT to KIX32/WKIX32 and the KiXtart script will from the from the NETLOGON folder.

HTH,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
Page 2 of 2 <12


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 918 anonymous users online.
Newest Members
rrosell, PatrickPinto, Raoul, Timothy, Jojo67
17877 Registered Users

Generated in 0.057 seconds in which 0.025 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org