Hi,
As part of an Active Directory cleanup I'm having to change users login names and, therefore, their home folder name and permissions. Using win32::perm I can change the permissions on the home folder and all child folders using
use strict;
use warnings;
use Win32::Perms;
my $user1 = 'john123';
my $home = 'C:\test_'.$user1;
# Create a new Security Descriptor and auto import permissions
# from the directory
my $dir = new Win32::Perms($home) || die;
$dir->Remove(-1); # remove defaults
my $user2 ='john321';
$dir->Allow('Domain Admins',FULL,FILE);
$dir->Allow('Domain Admins',FULL,DIR);
$dir->Allow($user2,CHANGE,FILE);
$dir->Allow($user2,CHANGE,DIR);
#$dir->Owner($user);
my $home1 = $home.'\*';
$dir->Set()or die "ERROR: Failed to set Permissions on folder(1)";
$dir->SetRecurse($home1)or die "ERROR: Failed to set Permissions on fo
+lder(2)";
$dir->Close();
which seems to do a very nice job. How can I do this recursively for all the files contained in the folder(s)?
When I try to set the path in SetRecurse to ...\*.* it doesn't work.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.