SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Renaming Files during FTP Upload

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
Renaming Files during FTP Upload
Author Message
fullingdale



Joined: 25 Nov 2008
Posts: 3
Country: United Kingdom

Post Renaming Files during FTP Upload Reply with quote
I wonder if someone could help with some script.

I am uploading a file to an FTP using 24x7 Scheduler and want to rename it during the process.

For example the local file is called TEST.XML

I need to rename that to TEST.TMP or TEST.XML.TEMP

Then FTP it.

Finally, when it's complete, rename it back to TEST.XML

My present script looks a little like the following (obviously altered so as not to show confidential info).

Code:
Dim file_list, string
Dim short_file_name, string
Dim ftp_file_name, string
Dim local_file_name, string
Dim archive_file_name, string
Dim no_more, boolean
DIm tmp,string

// Search files on FTP server.
Dir "Z:\\PATH\\FOLDER\\*.*", file_list
isEqual file_list, "", no_more
IfThen no_more, DONE

// Upload file(s) to FTP server.
LoopUntil no_more, END_LOOP
   GetToken ",", file_list, short_file_name
   Concat, "REMOTEDIR", short_file_name, ftp_file_name
   Concat, "Z:\\PATH\\FOLDER\\", short_file_name, local_file_name
   FTPPutFile "FTPIP", "USER", "PASSWORD", local_file_name, ftp_file_name
   Concat, "Z:\\PATH\\FOLDER\\DONE\\", short_file_name, archive_file_name
   FileMove local_file_name, archive_file_name
   isEqual file_list, "", no_more
END_LOOP:

DONE:


Any help, appreciated.
Tue Nov 25, 2008 9:24 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7838

Post Reply with quote
Hi. Local and remote files can have different name. On a first look your script looks ok. If it doesn't work, please enable tracing options, rerun the job and post a trace of the job execution so we can pinpoint what goes wrong.
Tue Nov 25, 2008 9:51 am View user's profile Send private message
fullingdale



Joined: 25 Nov 2008
Posts: 3
Country: United Kingdom

Post Reply with quote
Ah, you have missed what I am after ... there's a service which watches the FTP site for incoming XML files ... but it's polling so often that it's collecting the files, before this script has finished uploading them.

Hence needing to rename the file while the upload is taking place.

Hope that makes sense.
Tue Nov 25, 2008 10:04 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7838

Post Reply with quote
Maybe you are thinking about use of FTPRenameFile, but you didn't say that :)

I guess you can first upload XML files with non-XML extensions to the FTP server, then rename them after the upload is complete.


ConcatEx "REMOTEDIR", short_file_name, ".TMP", ftp_file_name_tmp
...
FTPPutFile ...
FTPRenameFile ... , ftp_file_name_temp, ftp_file_name
...


--- by the way, commas aren't needed after Concat keyword
Tue Nov 25, 2008 8:50 pm View user's profile Send private message
fullingdale



Joined: 25 Nov 2008
Posts: 3
Country: United Kingdom

Post Reply with quote
Spot on, thanks!

I guess that this is something that I should have known, but yesterday was my first time using 24x7 and was snowed under with thing to do.

Many thanks for the answer!
Wed Nov 26, 2008 3:27 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.