I did this work, and here is the code ... Thanks to everyone for their help ...
use File::Path;
use Cwd 'abs_path';
my $folName = $ARGV[0];
if(length($folName) > 0){
$path = abs_path($0);
$path = substr($path, 0, index($path,'FolderCreator.pl') );
$pwd = `pwd`;
chop($pwd);
$index = index($path,$pwd);
if( index($path,$pwd) == 0 ) {
$length = length($pwd);
$path = substr($path, $length+1);
$index = index($path,'/');
while( $index != -1){
$nxtfol = substr($path, 0, $index);
chdir($nxtfol) or die "Unable to change dir : $nxtfol";
$path = substr($path, $index+1);
$index = index($path,'/');
}
}
unless(chdir($folName)){
mkdir("$USER_ID", 0700);
chdir($folName) or $succode = 3;
}
}
else {
print "Usage : <FOLDER_NAME>\n";
}
exit 0;
source
share