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
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