Gossamer Forum
Home : General : Perl Programming :

Setup backup scripts with long pathname

Quote Reply
Setup backup scripts with long pathname
I am using Robocopy and get an error when it tries copying very long path names. Anyway around this or a way to copy just this directory so my backups are complete?



Thanks for your help
Quote Reply
Re: [Rocky99] Setup backup scripts with long pathname In reply to
No idea without seeing the code or the error.
Quote Reply
Re: [Paul] Setup backup scripts with long pathname In reply to
if ($OS =~ /Windows*/ )
{
$BACKUP_DIR = "\\\\server\\backups[/url]";
$LOG_FILE = "$BACKUP_DIR"."\\"."backuplog.log";
$LOG_FILE2 = "$BACKUP_DIR"."\\"."backuplog2.log";
$BACKUP_COMMAND = "c:\\winnt\\system32\\robocopy.exe /SECFIX /V /MIR /IS /LOG+:$LOG_FILE";
$WAIT_SECONDS = 10;
}

printf ("INFO: Starting Backup command...\n");

foreach $FILES (@FOLDERS)
{
chomp ($FILES) ;

@PARTS = split (/[\\\/]/, $PATHS{$FILES});

$FILE_BACKUP_PATH = "$datepath"."$PARTS[$#PARTS]";

system ("$BACKUP_COMMAND $FOLDER_STORAGE_PATHS{$FILES} $BACKUP_DIR");

}



The error I receive from Robocopy is that it can't find a specified file even though robocopy displays the path of that file, and robocopy times out. The files are nested under folders and the path is > 256 characters under windows 2000 NTFS.



Hope this helps.
Quote Reply
Re: [Rocky99] Setup backup scripts with long pathname In reply to
Hmm how are you determining $OS?

If you are using $^O then you need to be looking for MSWin32 not Windows.

Also should $BACKUP_DIR have 4 leading slashes?

How is @FOLDERS populated?

Before calling the system command trying printing all paths to verify they are correct.

Also check the return value of system() - it should equal 0 to show there's no error.
Quote Reply
Re: [Rocky99] Setup backup scripts with long pathname In reply to
Also, you probably need to quote, or escape:

$FOLDER_STORAGE_PATHS{$FILES}

Cheers,

Alex
--
Gossamer Threads Inc.