Ray, 

You should not expect the community to write entire stuff for you, the 
community is for programmers to help each other with genuine queries, and not 
give ready made solutions.

No one learns to code over night! It needs hrs of patient efforts, and you ll 
have to work for yourself.

Being a new bee you should have a look at following sites they have all the 
information you need w.r.t the project you are working

http://search.cpan.org/~gbarr/perl-ldap-0.33/lib/Net/LDAP.pod

http://www.lc.leidenuniv.nl/awcourse/oracle/network.920/a96579/comtools.htm#632173

http://quark.humbug.org.au/publications/ldap/ldap_tut.html

http://www.faqs.org/rfcs/rfc2849.html (LDIF RFC)

http://www.tizag.com/perlT/perlstrings.php (printing of LDIF)

The above site have all the info you need, now ..be a good boy and do it 
yourself. :)

Regards,
Yash



-----Original Message-----
From: Jyotishmaan Ray [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 20, 2008 1:35 AM
To: perl-ldap@perl.org; Peter Karman
Subject: Re: Perl Script Needed To Create The Home Drectories.

Your script is not clear. Please provide step wise solution. I am a new bie in 
perl.



 

--- On Tue, 8/19/08, Peter Karman <[EMAIL PROTECTED]> wrote:
From: Peter Karman <[EMAIL PROTECTED]>
Subject: Re: Perl Script Needed To Create The Home Drectories.
To: [EMAIL PROTECTED], "perl-ldap@perl.org" <perl-ldap@perl.org>
Date: Tuesday, August 19, 2008, 10:46 PM


On 08/19/2008 11:46 AM, Jyotishmaan Ray wrote:
> Dear All,
> 
> I am a new bie in perl. I have to create the home directories of 424
students in a server machine. 
> 
> The path of the home directory would be :-
> 
> /mnt/btech/formatted-rollno.
> 
> where formatted-rollno ="s08-1-5-097"
> 
> 
> And the input file contains all the rollnos of 424 students.
> 
> 
> 
> A sample student file of five  students is as given below (in the format
of uid, MD5 password) as below:-
> 
> 
> 
> s08-1-5-093     
> s08-1-5-094     
> s08-1-5-095       
> s08-1-5-096            
> s08-1-5-097     
> 
> For example, the home directories,  for the rollno, s08-1-5-097, would be
this->
> 
> 
>  /mnt/btech/s08-1-5-097
> 
> All the student should have read/write and execute permissions in their
home directories.
> 
> 
> Can any one provide the perl script  for doing this ?
> 


look at the Path::Class module on CPAN. Should make it easy.

use strict;     # always
use Path::Class;
my $base = '/mnt/btech';
foreach my $rollno (@get_my_list_of_rollnos) {

    my $path = dir( $base, $rollno );
    $path->mkpath(1);
    chown $path, $rollno or die "can't chown $path $rollno: $!";
    # ^^ probably needs to run as root to work

}

and next time, ask on the right list for this kind of thing. This is not an
LDAP question.



-- 
Peter Karman  .  [EMAIL PROTECTED]  .  http://peknet.com/




      

Reply via email to