Subj : File deleting & attributes
To : Nightfox
From : Digital Man
Date : Wed Sep 09 2009 09:30 am
Re: File deleting & attributes
By: Nightfox to All on Thu Sep 03 2009 08:50 pm
> I'm working on a JavaScript script for Synchronet that involves extracting
> an archive into a temporary directory, and then it will recursively delete
> the temporary directory when it's done.
> My BBS is running in Windows 2000, and it looks like if one of the
> extracted files has the read-only attribute set, file_remove() doesn't
> remove it. I then started to look into how file attributes are represented
> in Synchronet's JavaScript model and if it's possible to change them. I
> noticed that the File class has a property called 'attributes', and there's
> also a function called file_attrib(), which will give you a file's
> attributes. The attributes are represented by a number, but the docs don't
> seem to say what that number means or if there are any variables anywhere
> that represent different file attributes. I checked sbbsdefs.js and didn't
> see any mention of file attribute definitions in there.
>
> So, my questions are:
> 1. Is it possible to delete a file regardless of its attributes? And if
> so, how?
No, you would have to change the attributes first. I would suggest modifying
your file extraction command line to strip any read-only attributes.
> 2. For File's attribute property and file_attrib()'s return value, what are
> the attribute values that it can be checked against (or more precisely,
> where can I find the list of attributes)?
The attribute bit values are platform specific (e.g. different from Windows and
Linux). For example, on Windows:
> 3. If you wanted to change a file's attributes, can that be done by opening
> it with the File class, changing its attributes property, and saving the
> file?
Yes, but no "saving" is necessary, just close the file.
digital man
Snapple "Real Fact" #35:
Elephants only sleep 2 hours a day.
---
� Synchronet � Vertrauen � Home of Synchronet � telnet://vert.synchro.net