Page 1 of 1

File Attributes

Posted: Thu Jun 21, 2007 10:31 am
by Patz QuickBASIC Creations
It would be nice if BASIC had an easy way of changing them, but so far I don't see one. So, does anyone have an easy way of checking and setting various attributes like HIDDEN, READ-ONLY, SYSTEM, etc.?

Posted: Thu Jun 21, 2007 5:48 pm
by moneo
Do you want to see or change file attributes from within a QB program? If so, you have a problem. I've only been able to do this by linking with the QuickPak Professional Library and it's functions.

If you only need to do this from the DOS commandline, you can use the following utilities:
1) ATTRIB utility which comes with DOS. A bit clunky, but it might serve your purpose. Do ATTRIB /? for instructions.

2) FA utility program from the Norton Utilities. You may be able to still find it around.

3) !ATTR utility which I wrote. I can send it to your email address.

Even with the library functions, it's not that easy. I takes about 300 lines of QB code to do it right.

Regards..... Moneo

Posted: Wed Jun 27, 2007 1:06 pm
by Patz QuickBASIC Creations
Well, then I guess I have a problem :P

I know Plasma made a routine for checking for HIDDEN files and such, which he dubbed DIR2$, as (you guessed it) a replacement for DIR$.

But, yes. What you described is exactly what I need to do. Load the attributes into some sort of variable (I'm flexible) and be able to change them and write them back to the file. Maybe I'll find a way to shell to ATTRIB or something. Sure, send !ATTR to my email, patzbasic [AT] gmail.com

Thanks for your input.

Posted: Wed Jun 27, 2007 6:37 pm
by moneo
Patz,
No sense in sending my !ATTR utility. I just compared mine to DOS's ATTRIB, and they are virtually the same. Mine generates an errorlevel that can be tested from within a batchfile, in case there was some anomaly, like file doesn't exist, illegal attribute, like trying to set a directory to Read Only, etc. I figure you don't need any of this.

Yes, try doing a shell to ATTRIB. Should work. Let me know.

If you later figure out that you'd like !ATTR, let me know and I'll send it.

Regards..... Moneo

Posted: Mon Jul 02, 2007 1:11 pm
by Patz QuickBASIC Creations
I looked into it some more (the computers I can use for internet are blocked against DOS), and ATTRIB's output seems straight forward, and easy to manipulate. Shouldn't be too hard to shell to it.

Yeah, I'll post more once I do more. Been lazy for the last week :P

Posted: Thu Aug 02, 2007 9:46 pm
by Master-of-Mischief
An easy way to change attributes, well first let me ask, are you familiar with changing attributes with interrupts?