Hi,
I need to delete some zero-length files from a directory. They are created by my
program whenever it happens to create files that eventually have nothing written
to them, and can be discarded
Any ideas?
Brian
			
			
			
				Make sure the file is closed and use DeleteFile
INT = DELETEFILE(name as STRING)
Shouldn't be a problem with 0 length files. If you need to check the file lengths just open them and Len() the file variable.
			
			
			
				Wayne,
Thanks for the quick reply. What was happening is that filelen wasn't working on the intended file,
because (I think) of the double "\\" it needs. But DELETEFILE works without the double slashes
Take out the IF and ENDIF lines and DeleteFile works
   filelen=LEN(pathandname+"_5 FOBS.TXT")
IF filelen=0
   DeleteFile(pathandname+"_5 FOBS.TXT")
ENDIF
Hmmm, how to get round that...
Brian
			
			
			
				Open the file with OpenFile then use Len on the File variable, rather then the file path string. Checking the path string will only return the length of the string which will never be 0.
			
			
			
				Wayne,
That cracked it. I'm checking the file length before using CLOSEFILE
If it's zero after closing, then DELETEFILE works OK
Thanks for a fresh pair of eyes...
Brian