Go Back   Computer Forums > General Computing > Programming
Join Computer forums Today

Thread Tools Search this Thread Display Modes
Old 01-01-2007, 05:36 AM   #1
Site Team
David Lindon's Avatar
Join Date: Dec 2002
Posts: 15,233
Default Automated backup script

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

[url=http://www.LNXPS.NET]LNXPS.NET - The XPS Library]
David Lindon is offline   Reply With Quote
Old 01-02-2007, 06:04 AM   #2
Golden Master
joxley1990's Avatar
Join Date: Oct 2005
Posts: 7,846
Send a message via AIM to joxley1990 Send a message via MSN to joxley1990
Default Re: Automated backup script

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..
joxley1990 is offline   Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

All times are GMT -5. The time now is 05:30 AM.

Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2016, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0