DeleteDir
DeleteDir FolderName$
 
Parameters:

    FolderName$ = The Folder name of the directory you wish to delete
Returns: NONE
 

      DeleteDir will remove a directory.



FACTS:


      * DeleteDir does NOT recursively delete any sub directories within the directory your deleting.

      * Before using DeleteDir, always check if the FolderName actually exists. As deleting a none existent directory will cause PB to return a run time error.



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.


  
; Get the location of the windows Temp dir and add
; a folder called "PB_MakeDir_test" to it.
  ThisDir$=TempDir$()+"PB_MakeDir_Test"
  
; Check if the this Folder Already exists ?
  If FolderExist(ThisDir$)=false
     
   ; Display a message that we've created a Temp folder
     Print "Creating Temp dir at:"+ThisDir$
     
   ; Create a Directory called PB_MarkDir_Test in
   ; the WindowsTemp folder
     MakeDir ThisDir$
     
  EndIf
  
; Check if the FOlder exists ?  if so, delete it
  If FolderExist(ThisDir$)=false Then DeleteDir ThisDir$
  
; Display the screen and wait for a key press
  Sync
  WaitKey
  


This example would output.

  
  Creating Temp dir at:C:\Windows\Temp\PB_MakeDir_Test
  

 
Related Info: DeleteFile | FolderExist :
 


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