For portability with such things, you might try File::Copy. It's a core module that I'm pretty sure works well under Windows and handles a lot of the OS specific directory structure stuff (I don't have a Windows machine immediately in front of me to test). You might also need File::Copy::Recursive for the first copy command, which may not be a core module, but I know it works well under Windows for the most part. So, one way to do this is:
Code:
use File::Copy;
use File::Copy::Recursive qw{ dircopy };
if ( $OS eq "Ubuntu" ) {
if ( -d "$ENV{'HOME'}/MY_S" ) {
my $home = $ENV{'HOME'};
my $dest = "$home/MY_S";
dircopy( "$home/bin", "$dest/home_dir" );
copy( "$home/.kshrc", "$dest/home_dir" );
copy( "$home/.bashrc", "$dest/home_dir" );
}
}
In general if you can find a core Perl module to do such system tasks you take a lot of the guess work out of the OS specific stuff that can cause some portability problems.
Bookmarks