Important alert: (current site time 7/15/2013 9:19:35 PM EDT)
 

article

Backup Files With One Line of Code!!!

Email
Submitted on: 4/16/2001 1:52:23 PM
By: James "Descent" Davidson  
Level: Beginner
User Rating: By 5 Users
Compatibility: 5.0 (all versions)
Views: 12263
(About the author)
 
     This code backs up anyfile with just one simple line of code! It is easy and can be used with all applications. Check this out!!

 
 
Terms of Agreement:   
By using this article, you agree to the following terms...   
  1. You may use this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this article from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.
				@ARGV="http://www.coolplace.com/cool.log";
$^I=".bk";


################DO NOT COPY PAST THIS LINE###########

Ok, now let me explain the above code.

First, we set @ARGV = to the file location so that perl knows where the file is that is needs to back up. The next line of code, "$^I" basically means 'backup'. We set $^I = to the file extension we want to use on the back up file. So if the file's name is cool.log, after we run the "backup code" it will create another file with the name cool.log.bk with all the same stuff cool.log had in it. Simple as that!! ;-)


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Beginner category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
6/5/2002 5:08:44 PMJohn Winger

This didn't work for me and I don't see how it can work. Where do you do the actual copy and renaming? Does this maybe only work on Unix/Linux?
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular article, please click here instead.)
 

To post feedback, first please login.