DeleteFile
DeleteFile Filename$
 
Parameters:

    Filename$ = The Filename of the file you wish to delete
Returns: NONE
 

      DeleteFile will delete a file.



FACTS:


      * Before using DeleteFile, always check if the file exists, as PB will return a run time error, if you attempt to delete something that doesn't exist.



Mini Tutorial:


      This example will create a blank file on the C: Drive called "TestFile.txt" , it then displays the info about this file and then removes itself.


  
  
; Create a variable of the files Filenames
  Filename$="C:\TestFile.txt"
  
; Make the blank file, 100 bytes in size
  MakeFile Filename$,100
  
; display the info about the created file
  Print "File Name:"+Filename$
  Print "File Exist:"+Str$(FileExist(Filename$))
  Print "File Size:"+Str$(FileSize(Filename$))
  
; now delete this file, as it's no use to use anymore
  DeleteFile Filename$
  
  
; Display the screen and wait for a key press
  Sync
  WaitKey
  


This example would output.

  
  File Name:C:\TestFile.txt
  File Exist:1
  File Size:100
  

 
Related Info: DeleteDir | FileExist | FileType | WriteFile :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com