On Sat, 16 Feb 2002 20:23:02 +0000, [EMAIL PROTECTED] (Craig Eberly) wrote:
>Hey, any help would be appreciated. >I just wanted to make a simple backup script to backup any file i >specified quickly.. and eventually let it accept options and whatnot for >directories, but right now, I'm just trying to get it to keep the file >permissions of the original file. I'm using File::Copy for the >copying, and I thought Digest::MD5 would work for the permissions >problem. > >The backup itself works like this, but the # lines are what i was >trying to do to keep the file permissions. This not only doesnt work, >but it causes the backup process to break as well. Anyone have any >ideas? Here, this shows you the basics of retaining file permissions. #!/usr/bin/perl use warnings; use File::Copy; use strict; my $mode = (stat $ARGV[0])[2]; copy( "$ARGV[0]", "$ARGV[0]\.bak" ); chmod ($mode, "$ARGV[0]\.bak"); print "Backup completed.\n"; exit 0; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]