Quote: "I'm making a program that searches a given folder for certain file types. is there any way to determine whether a file is hidden or not? Because, DB will not access hidden files (generates an error), but it doesn't know they're hidden until it tries 2 access them.... any ideas??"
You can do this:
Directory$="c:\"
execute file "cmd","/c attrib >att.txt",Directory$,0
This runs the attrib program via the command prompt and sends the output to "att.txt". Change the directory string to whatever directory you're working in (you can use "Directory$=get dir$()" ). The file will be located in Directory$. You can open it up and check the contents of that file to see file attributes.
It'll be like this (I changed upgrade5_8.txt's attributes for this example):
A C:\program files\darkbasic pro\DBProAssociator.exe
A C:\program files\darkbasic pro\Launch.cfg
A C:\program files\darkbasic pro\Launch.exe
A SHR C:\program files\darkbasic pro\upgrade5_8.txt
Each letter on the left side represents:
A = Archive
S = System
H = Hidden
R = Read Only
If you want to check for a specific file do this:
Directory$="c:\"
File$="filename.ext"
execute file "cmd","/c attrib "+File$+" >att.txt",Directory$,0
It's a messy way to do it (flashes the command prompt window)... but it works.
Just in case you don't know... attrib is not only for listing the attributes for each file but you can use it to edit the attributes. So you can make a program that automatically unhides a file before loading it.
Here's the attrib syntax:
Displays or changes file attributes.
ATTRIB [+R | -R] [+A | -A ] [+S | -S] [+H | -H] [drive:][path][filename]
[/S [/D]]
+ Sets an attribute.
- Clears an attribute.
R Read-only file attribute.
A Archive file attribute.
S System file attribute.
H Hidden file attribute.
[drive:][path][filename]
Specifies a file or files for attrib to process.
/S Processes matching files in the current folder
and all subfolders.
/D Processes folders as well.
Also it doesn't work too well in full screen (big white screen) so you'll have to put it into windows mode before "execute file" then back into full screen after it.
set window on
Directory$="c:\"
execute file "cmd","/c attrib >att.txt",Directory$,0
set window off
Hope this helps.