Walking the file system

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: BCDesign (BCDesign_at_discussions.microsoft.com)
Date: 08/31/04


Date: Tue, 31 Aug 2004 13:47:01 -0700

I wasn't sure where the best place to post this was so I am starting here,
and if anyone can point me to a better group, I'd appreciate it.

The problem I have is that I want to reset permissions on a large number of
files and folders during an overnight process. There are about 5000 users
who maintain their My Documents folder on the server, and because of copying
and moving issues, permission regularly get messed up. As such, I would like
to write a process that can run nightly to go through these files and folders
and reset all permissions back to what they should be.

There are two problems I am encountering and would like help with. One is
the fastest way to retrieve a list of all the files and folders, about 3
million total. I know that I can do this with DirectoryInfo objects, but I
would assume there is some overhead in the creation of these objects, and
while not a big deal normally, it can add up with 3 million files and folders
to sort through. Is there a system call that can retrieve a list of files
and folders quickly? Would it benefit me to have a C++ class that constructs
a string array for me and passes it back to the C# code? If so, what would
be the best system call for doing this quickly?

Second is the setting of permissions. Is it faster to try to check and
compare the permissions and only set the ones that need it, or is it faster
to just set the needed permissions regardless of how they are currently set?
Overwriting permissions is just fine, so either solution would work. The
question is just one of speed.

Any help anyone could provide me on this issue would be greatly appreciated.

Thanks,
Benjamin R. Carleski



Relevant Pages

  • Re: NTFS Security Question.
    ... A subordinate object DOES not inherit the PARENT perms (in ... will assume "Nebulous" permissions that refer to the LINK ... The trick is to PROPOGATE to all FILES (not Folders and Files - that would ... Since Windows 2000 deny NTFS permission does not work ...
    (microsoft.public.windowsxp.security_admin)
  • RE: ISA 2004 REPORT FAILURE
    ... Did as you suggested and turned auditing on for the system and folders ... that is setting the wrong permissions of the folders ... Microsoft CSS Online Newsgroup Support ... This newsgroup only focuses on SBS technical issues. ...
    (microsoft.public.windows.server.sbs)
  • RE: ISA 2004 REPORT FAILURE
    ... the ISA Reports still fail because ... I can change the permissions manually ... on the ISALogs and ISASummaries folders ... Microsoft CSS Online Newsgroup Support ...
    (microsoft.public.windows.server.sbs)
  • Re: Personal Media Drive
    ... > much more knowledgeable about Windows than I am. ... You restrict access by assigning permissions to drives, folders and files. ...
    (microsoft.public.windows.mediacenter)
  • Re: Administrator/User security issues
    ... i have setup all the accounts, ... folders for testing the security. ... permissions but the admin. ...
    (microsoft.public.windowsxp.security_admin)