Page 1 of 1 1
Topic Options
#209447 - 2014-09-06 12:54 PM Del function failure?
Statler Offline
Fresh Scripter

Registered: 2004-09-25
Posts: 11
Hello

Iīm working with Kix 4.60 and Kixforms 2.47 and Windows 7 - 64bit.
I wrote a script that contains a function to delete different files.

function loeschen()
for $x = 0 to 10
del $Filename[$x] /c)
next
endfunction

But the Kix-script doesnīt delete the files with "del" - it only changes the attrib flags by setting the -h, -s, -r and -i flag.

Does anybody knows what Iīm doing wrong and what could I do to fix that Problem?

Thank you very much in advance for any hints.

Statler

Top
#209448 - 2014-09-06 02:08 PM Re: Del function failure? [Re: Statler]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4574
Loc: USA
Maybe I don't understand your script, but I really don't see the need for the function(yet). Here is another version that will display the filename if the file exists, and then the error code when it deletes.


 Code:
  $FileNames="File1","File2","File3"
  for $x = 0 to ubound($Filenames)
    if exist($FileNames[$x])
      ? $filenames[$x] + " : "
      ;del $Filenames[$x] /c
      @serror
    endif
  next


Remove the semicolon on the del line when you have tested this and it appears to be working with the right set of files.
_________________________
(... better days ahead)

Top
#209449 - 2014-09-06 03:00 PM Re: Del function failure? [Re: Allen]
Statler Offline
Fresh Scripter

Registered: 2004-09-25
Posts: 11
Hi Allen,

Thatīt right, that itīs not poosible to see the need of a function - because itīs only a small part of a big script.
But you helped me a lot with the hint that I could use the "@serror" Funktion.
With that, I could see that there is a access-protection problem wich I could solve now.
Many thanks for your help.

Statler

Top
#209450 - 2014-09-06 05:47 PM Re: Del function failure? [Re: Statler]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
I think my EMF class is getting to me. I opened this expecting a question about the DEL operator.
Top
Page 1 of 1 1


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

Who's Online
1 registered (Henriques) and 2516 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

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

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