Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
This is where I get stuck .... I guess I need some kind of recursion or a way to search all directories and their respective sub-directories. Also I need a way for my script to remember where each file (if it has the suid or sgid bit) is located so the log file has:chdir("/")||die "Error:$!\n"; opendir(ROOT_DIR,"/")|| die "Error:$!\n"; foreach $dir_cont (sort readdir(ROOT_DIR)){ next if $dir_cont =~s/^\.\.?$/; if (-f $dir_cont){ log_sbit($dir_cont) if (-u $dir_cont || -g $dir_cont); } elsif (-d $dir_cont && opendir(SUB_DIR,"$dir_cont"){ do_stuff....... }
I know that there are various modules out there (File::Find) that I can utilize, but since I am still in my learning stages, I would like to go on this journey of reinventing the wheel so to speak, so I can better understand perl and learn some things along the way :) All help will be much appreciated./usr/local/bin/some_file suid /var/log/.hidden/file sgid /home/greco/bin/be_greco sgid
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Recursion
by DBX (Pilgrim) on Aug 03, 2001 at 02:09 UTC | |
by s0ttle (Scribe) on Aug 03, 2001 at 16:35 UTC | |
Re: Recursion
by TheoPetersen (Priest) on Aug 03, 2001 at 02:35 UTC | |
by dataDrone (Acolyte) on Aug 03, 2001 at 05:39 UTC | |
by petral (Curate) on Aug 03, 2001 at 10:29 UTC | |
Re: Recursion
by tachyon (Chancellor) on Aug 03, 2001 at 17:53 UTC | |
Re: Recursion
by Hofmator (Curate) on Aug 03, 2001 at 18:31 UTC | |
Re: Recursion
by Beatnik (Parson) on Aug 03, 2001 at 12:16 UTC |