https://www.freebasic-portal.de/befehls ... r-197.html
The only amend I did is the CHDIR in Line 3 because I wanted to try the code in various folders. The result the console ouputs is obviously errorous: The files changelog.txt, fbx.exe and readme.txt are categorized as folders.
The funny thing is: the differentiation between files ( archives) and folders works perfectly fine in all folders of my hard drive except for the path where the Freebasic compiler is in. I tried it on 2 workstations. Both show the same effect. I am using Win10 64bit. I don´t understand why this happens and I wonder how this can be fixed?
The code is:
Code: Select all
#INCLUDE "dir.bi"
CHDIR "C:\Users\padawan\FreeBASIC-1.05.0-win64"
DECLARE SUB listFiles (filespec AS STRING, attrib AS INTEGER)
SUB listFiles (filespec AS STRING, attrib AS INTEGER)
' alle Dateien mit den angegebenen Attributen auflisten
DIM filename AS STRING
filename = DIR(filespec, attrib)
DO
PRINT SPACE(4); filename
filename = DIR("", attrib)
LOOP WHILE LEN(filename)
END SUB
PRINT "subfolders"
listFiles "*", fbDirectory
PRINT "archive files:"
listFiles "*", fbArchive
PRINT "hidden and/or system files beginning with an 'a':"
listFiles "a*", fbHidden OR fbSystem
SLEEP
Code: Select all
subfolders
.
..
bin
changelog.txt
doc
examples
fbc.exe
inc
lib
readme.txt
archive files:
changelog.txt
FB-manual-1.01.0.chm
fbc.exe
readme.txt
hidden and/or system files beginning with an 'a':