By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,710 Members | 1,960 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,710 IT Pros & Developers. It's quick & easy.

copy a file

P: 11
I want to do a backup of a file from one area where I don't have write permission onto my area where I do have write permission ?How to do it ?
do I do a copy first and then a rename ? if so how
Dec 16 '08 #1
Share this Question
Share on Google+
4 Replies

P: 62

Copy: Perl Tutorial - Copy

Dec 16 '08 #2

P: 62
Ok, sorry.
Rename: Renaming a File with Perl's RENAME Function
Dec 17 '08 #3

Expert Mod 2.5K+
P: 3,503
Or, you could visit the perldoc documentation for rename.

On a side note from the link that Arepi provided, in there the example they show uses a print statement to show an error if the rename didn't work. Personally, I would rather use the die() function instead of the print, like so:
Expand|Select|Wrap|Line Numbers
  1. rename("file.txt", "newfile.txt") || die "Cannot rename file:  $!";
The $! in the die function prints the actual error received from the attempted rename if it fails. This is usually a bit more helpful.


Dec 17 '08 #4

P: 11
I'm sorry to to not have thanked the posters earlier.Appreciate the help
Dec 18 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.