![]() |
#1 |
Junior Member
Join Date: Aug 2007
Posts: 12
|
Trouble with file attributes
I have two objectives that I'm having difficulty with:
1) Removing a single attribute flag from a file (I want to remove the archive flag from a set of files, but not change anything else on them). 2) Copy a folder without copying the files/folders within the folder. For issue 1, ${GetFileAttributes} and SetFileAttributes are proving difficult to work with; should I just make exec calls to attrib.exe? My main concern is efficiency as my utility may be working on 1000+ files at a time. For issue 2, currently I'm just checking the existence of the folder name I want to copy at the target location and using CreateDirectory. Unfortunately, this means the folder may have differing attribute flags. code: doesn't work because SetFileAttributes doesn't seem to accept a variable as input. Anyhow, any feedback'd be appreciated and hopefully this post will generate some searchable help on the subject. I couldn't find beans when searching about this type of thing. QM |
![]() |
![]() |
![]() |
#2 |
Junior Member
Join Date: Aug 2007
Posts: 12
|
Well, I might've solved problem 2 like so:
code: The IntCmp jumps past the SetFileAttributes if the attributes are already equal. Is this acceptable to do? Will I run into issues on various versions of Windows or anything? I only have a 98SE and XP machine to test on. I haven't gotten to problem 1 yet, but I imagine I'll use System::Call there as well. QM |
![]() |
![]() |
![]() |
#3 |
Senior Member
|
#1: Call GetFileAttributes(A/W) then subtract from the output value FILE_ATTRIBUTE_ARCHIVE with an IntOp, then call SetFileAttributes(A/W) and push the modified attributes.
You will still have to figure out though how to deal with the case that the archive attribute was not set on a file, but you still subtracted FILE_ATTRIBUTE_ARCHIVE from the list of attributes ... Are the file attributes different between files? If not then you could just check the attributes of one file then set the same (+ or - anything) to the rest of the files in that folder. CF |
![]() |
![]() |
![]() |
#4 | |
Junior Member
Join Date: Aug 2007
Posts: 12
|
Quote:
I'll have something to show for this pretty soon. I wrote a file backup/synchronize/archive utility using NSIS and I'm putting it through testing now. QM |
|
![]() |
![]() |
![]() |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|