SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
How to copy a file at remote computer

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
How to copy a file at remote computer
Author Message
felixc



Joined: 24 Sep 2007
Posts: 20
Country: Hong Kong

Post How to copy a file at remote computer Reply with quote
Hi,

I was writing a script to send an email attached with a file at remote computer, a log file at our database servers.

My script coded like this
Set ( attachment, "\\servername\dir_name\filename.txt")
MailSendWithAttachment(..., attach...)

But I got an error says that the file specified is not accessible.
Then I try to use FileCopy to copy the file to a local directory but got same error message. It seems that the software recognised an invalid file name due to the escape character.

Please advise how to specify a file at remote computer. I cannot map it as a network drive.
Thu Sep 27, 2007 5:27 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7962

Post Reply with quote
Hi,

"\" is a default escape character. Please see FAQ or Special ASCII symbols in the on-line help for more details. If you want to use it is a literal you must double it.

Code:
Set ( attachment, "\\\\servername\\dir_name\\filename.txt")

Thu Sep 27, 2007 9:24 am View user's profile Send private message
felixc



Joined: 24 Sep 2007
Posts: 20
Country: Hong Kong

Post Another error message Reply with quote
Hi,

I tried your suggestion but got another error message. "Error reading "file name".
The string in the "file name" is correct and I can open it with a notepad at same workstation.
Please advise.


Felix
Thu Sep 27, 2007 10:32 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7962

Post Reply with quote
Please let us review your code. We are unable to help you if we don't know what you are doing. If your code contains sensitive information such as email addresses and/or passwords, replace them with asterisks or other wildcards, but please keep your file names as is, so we can see the problem.
Thu Sep 27, 2007 10:37 pm View user's profile Send private message
felixc



Joined: 24 Sep 2007
Posts: 20
Country: Hong Kong

Post My code Reply with quote
Hi,

Thanks for help.
===============================================
Dim Sender, string
Dim Recipients, string
Dim Subject, string
Dim Message, string
Dim Attach, string
Dim Current_time, time
Dim Time_string, string

Now( current_time )
Format( current_time, "hh:mm:ss", Time_string)
Set( Sender, "Job.IT")
Set( Recipients, "*****@*****.**")

Concat( "System log of Rep Server of AMC at ", time_string, Subject )
Set( Message, "System log from AMC Portia server.\n")
Set( Attach, "\\\\portia_ad\\RepLog\\PRS.log")
MailSendWithAttachment( Sender, "", Recipients, Subject, Message, Attach )
=========================================================

Felix
Thu Sep 27, 2007 10:45 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7962

Post Reply with quote
Please try the following. I simplified you script to make it more readable, and added file copy to local folder, so that MailSend… can use a local file (I don't think email attachments can refer to UNC names).

I added line wrapping options only because the web page will wrap the long line and it can split it in wrong places.

Code:
FileCopy( "\\\\portia_ad\\RepLog\\PRS.log", "C:\\temp\\PRS.log" )
MailSendWithAttachment( "Job.IT", "", "*****@*****.**", &
      "System log of Rep Server of AMC at @T"hh:mm:ss"", &
      "System log from AMC Portia server.", &
      "C:\\temp\\PRS.log" )
FileDelete( "C:\\temp\\PRS.log" )

Thu Sep 27, 2007 11:44 pm View user's profile Send private message
felixc



Joined: 24 Sep 2007
Posts: 20
Country: Hong Kong

Post The problem is fixed. Reply with quote
Thank you
Fri Sep 28, 2007 1:50 am View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.