Automated backup script

David Lindon

Golden Master
Messages
15,233
I'm trying to create an automated backup script that reads the last modified date on a file and copies it to a network drive. I want to create an incremental backup so each day it copies that files that have been modified that day to the back drive. I came up with a quick test in perl to read the last modified date from a file but the trouble is, if the file location has a space in it the script fails. Any ideas?

Basic outline:

$file1 = "C:/Documents and Settings/David Lindon/My Documents/test.txt";

use File::stat;
use Time::localtime;

$date_string = ctime(stat($file1)->mtime);

----
Works ok if $file1 = "C:/test.txt";

But not when there is a space
 
Ok well obviously you will have to be flexible with this.. why not make a folder in the C: drive, named "Backup" then just make a shortcut to that in your Documents folder..

So, for example, make a folder in the C: drive, named "Backup" or whatever you want, then write the line as " $file1 = "C:/Backup/test.txt;"

Then, just go into my documents folder, and make a shortcut, to that folder in the C: drive..

That's what I would do..
 
Back
Top Bottom