Advertisement

04.23.2008 at 04:22PM PDT, ID: 23348681
[x]
Attachment Details

Perl script to copy files from one directory to other that is mounted

Asked by gusindhura in Perl Programming Language, Samba File Server

Tags: Perl

Using samba I mounted a UNIX folder into windows folder.
Now I am trying to get a perl script that copied files from C:\ to this mounted drive which is called - S:

Following is the script I have so far -

#!/usr/bin/perl -w

use File::Copy;

$TIME_STAMP=`perl -e'@x=localtime time-86400;printf"%4d_%02d_%02d\n",$x[5]+1900,$x[4]+1,$x[3]'`; # to get yesterday's date
$PATH1 = "\\itkm-kcc1\Knova home\Platform\Log"; # source file1 location
$PATH2 = "\\itkm-kcc2\Knova home\Platform\Log"; # source file2 location
$FILE1 = "general_activity-Production-ITKM-KCC1-.-$TIME_STAMP"; # source file 1 name
$FILE2 = "general_activity-Production-ITKM-KCC2-.-$TIME_STAMP"; # source file 2 name

#net use s: \\soca01\user; #used to mount the shared drive

opendir(IMD1, $PATH1) || die("Cannot open directory");
if (-e $FILE1)
{
copy($FILE1, S:\$FILE1) || die ("File cannot be copied");
}
closedir(IMD1);

opendir(IMD2, $PATH2) || die("Cannot open directory");
if (-e $FILE2)
{
copy($FILE2, S:\$FILE2) || die("File cannot be copied");
}
closedir(IMD2);

But this script is throwing syntax errors at various steps -

syntax error in file perl_copyfiles at line 3, next 2 tokens "use File"
syntax error in file perl_copyfiles at line 16, next 2 tokens "copy("
Spurious backslash ignored at perl_copyfiles line 16.
syntax error in file perl_copyfiles at line 23, next 2 tokens "copy("
Spurious backslash ignored at perl_copyfiles line 23.
Execution of perl_copyfiles aborted due to compilation errors.

I am new to perl scripting and having hard time trying to debug this.
Also please let me know how to automate this script using cron.

Your help is appreciated.

Thanks

Start Free Trial
[+][-]04.23.2008 at 05:39PM PDT, ID: 21426791

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.23.2008 at 05:47PM PDT, ID: 21426833

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.24.2008 at 08:01AM PDT, ID: 21431624

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.24.2008 at 08:51AM PDT, ID: 21432211

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.24.2008 at 08:53AM PDT, ID: 21432224

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.24.2008 at 08:56AM PDT, ID: 21432278

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.24.2008 at 08:57AM PDT, ID: 21432292

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.24.2008 at 09:09AM PDT, ID: 21432443

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.24.2008 at 09:10AM PDT, ID: 21432449

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.24.2008 at 09:50AM PDT, ID: 21432850

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.24.2008 at 09:55AM PDT, ID: 21432889

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.24.2008 at 09:57AM PDT, ID: 21432905

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.24.2008 at 10:18AM PDT, ID: 21433092

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.24.2008 at 10:42AM PDT, ID: 21433324

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.25.2008 at 09:24AM PDT, ID: 21441018

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.25.2008 at 10:11AM PDT, ID: 21441403

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.25.2008 at 03:33PM PDT, ID: 21443639

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.25.2008 at 04:15PM PDT, ID: 21443800

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.25.2008 at 04:34PM PDT, ID: 21443857

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Perl Programming Language, Samba File Server
Tags: Perl
Sign Up Now!
Solution Provided By: FishMonger
Participating Experts: 2
Solution Grade: A
 
 
[+][-]04.28.2008 at 09:36AM PDT, ID: 21455457

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.28.2008 at 10:51AM PDT, ID: 21456023

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628