Filedelete strange behavoir

Started by smarr, February 05, 2015, 07:22:25 AM

Previous topic - Next topic

smarr

Hello,

I am faced to this strange behavior of filedelete function : it always return a TRUE value whatever the filename I use, an existing one (as expected), an nonexisting one and even an invalid one !
Before to delete a non existing file, I try to filecopy it, of course the copy fails, but the delete return TRUE

The c:\temp\cccsssssss file doesn't exist
The c:\temp\winv.txt exits
The Y:\tem:p\wi:nv.txt is invalid filename

Your thought ?

************************************************************

*** Lancement du débogage ***

==============================
Jeu 05/02/2015 16:11:33
WinBatch 32 2014B
WIL DLL 6.14bnb
D:\Winbatch\wbt\DiversSrc\test4.wbt
Windows platform: NT, version: 5.1, build: 2600 (Service Pack 3)
ErrorMode: @CANCEL
Valid Code Signature: Yes
UAC Manifest Settings: level="asInvoker" uiAccess="false"
UAC Elevation Level: Unsupported Platform
==============================

********** ErrorMode: @OFF **********

errormode(@off)
(47) VALUE=> INT => 1

xx = fileExist("c:\temp\cccsssssss")
(47) VALUE=> INT => 0


xx = fileExist("c:\temp\winv.txt")
(47) VALUE=> INT => 1

xx = fileCopy("c:\temp\cccsssssss", "c:\temp\xui.txt", @false)
(47) VALUE=> INT => 1

WIL ERROR SUPPRESSED =>1009 (FileCopy : Impossible d'ouvrir le fichier SOURCE)

xx = filedelete("c:\temp\cccsssssss")
(47) VALUE=> INT => 1


xx = filedelete("c:\temp\winv.txt")
(47) VALUE=> INT => 1

xx = filedelete("Y:\tem:p\wi:nv.txt")
(47) VALUE=> INT => 1

exit
(47) VALUE=> INT => 0

--- Normal termination ---

;;;END OF JOB;;;


td

Per the FileDelete function's help file documentation, it will only return @False when the targeted file is marked Read-Only and therefore cannot be deleted.  In all other cases the function returns @True.  In other words, you cannot use FileDelete to test for the existence of a file before deleting it.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade