FileType
Type = FileType(Filename$)
 
Parameters:

    Filename$ = The name and path of the file you wish to check
Returns:

    Type = The Type of this file 1=File, 2 = folder
 

      The FileType function returns the file type of a filename or path name.


Type Values:

      0 = Not found
      1 = File
      2 = Folder



FACTS:


      * none



Mini Tutorial:


      This example, lists the files in the current path and displays their file type and file size.

  
; Get the current dir$ and place it in the PATH variable
  Path$=CurrentDir$()
  
; Read the first filename from this path
  File$=FirstFile$(path$)
  
; While File$ is not equal to a NULL string, run the while loop
  While File$<>""
     
   ; Add the current path$ and
     Filepath$=path$+"\"+file$
     
   ; Check if this is a filename or folder name
     If FileType(FilePath$)=2
      ; if it's a folder, then display it's name
        Print "Folder:"+File$
     Else
      ; if it's a FILEname, then display it's name
      ; and filesize in bytes
        Size=FileSize(Filepath$)
        Print "  File:"+File$+"  "+Str$(size)
     EndIf
     
   ; Grab the NEXT filename from this path
     File$=NextFile$()
     
   ; Jump back to the while while statement
  EndWhile
  
; Display the Screen and wait for a key press
  Sync
  WaitKey
  
  



This example would output might out something like this.

  
  Folder: HelloWorld
  File:MyFile.txt  3445
  
  

 
Related Info: :
 


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