SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
File Exisits

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
File Exisits
Author Message
dave



Joined: 16 Jun 2003
Posts: 41

Post File Exisits Reply with quote

Hi,
I have another question on Syntax. I have 12 files I need to have copied to another directory. These files sometimes exists and sometimes they do not.
I need to have a job do the following.
1) Check if a specific file exists in a directory. If it doesnt move on to the next file until the end.
2) If the file exists copy it to a specific location (i know how to do this)
3) Delete the file. Move to the next file until the end.

Thanks for your help.

Thu Dec 02, 2004 1:35 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7969

Post Re: File Exisits Reply with quote

If you copy all of them to the same location it is a simple as FileMoveEx with *.* file mask or using SyncLocalDir and then FileDeleteEx.

If you copy them to different locations then you would need to hard-code file names and locations or put this info into .INI or some other config file and then dynamically read file names and locations from that file processing appropriate files in a loop.

Here is a simple example for hard-coded names
/////////////////
Dim( counter, number )
FileMoveEx( "c:\\source_dir\\file1.csv", "x:\\target_dir1", counter )
FileMoveEx( "c:\\source_dir\\file2.csv", "x:\\target_dir2", counter )
....
FileMoveEx( "c:\\source_dir\\file12.csv", "x:\\target_dir12", counter )
////////////////

Or you coud simple create a batch file like below and then schedule it as a job

/////////////////
move /Y c:\source_dir\file1.csv, x:\target_dir1
...
move /Y c:\source_dir\file12.csv, x:\target_dir12
////////////////

: Hi,
: I have another question on Syntax. I have 12 files I need to have copied to
: another directory. These files sometimes exists and sometimes they do not.
: I need to have a job do the following.
: 1) Check if a specific file exists in a directory. If it doesnt move on to
: the next file until the end.
: 2) If the file exists copy it to a specific location (i know how to do this)
: 3) Delete the file. Move to the next file until the end.

: Thanks for your help.

Thu Dec 02, 2004 2:07 pm View user's profile Send private message
dave



Joined: 16 Jun 2003
Posts: 41

Post Re: File Exisits Reply with quote

: If you copy all of them to the same location it is a simple as FileMoveEx
: with *.* file mask or using SyncLocalDir and then FileDeleteEx.

: If you copy them to different locations then you would need to hard-code file
: names and locations or put this info into .INI or some other config file
: and then dynamically read file names and locations from that file
: processing appropriate files in a loop.

: Here is a simple example for hard-coded names
: /////////////////
: Dim( counter, number )
: FileMoveEx( "c:\\source_dir\\file1.csv",
: "x:\\target_dir1", counter )
: FileMoveEx( "c:\\source_dir\\file2.csv",
: "x:\\target_dir2", counter )
: ....
: FileMoveEx( "c:\\source_dir\\file12.csv",
: "x:\\target_dir12", counter )
: ////////////////

: Or you coud simple create a batch file like below and then schedule it as a
: job

: /////////////////
: move /Y c:\source_dir\file1.csv, x:\target_dir1
: ...
: move /Y c:\source_dir\file12.csv, x:\target_dir12
: ////////////////

The problem I am having is not the copy file it is the delete file.
Certian files will not be there every time the job is run. When I run the
delete file code it throws a error. Thats why I need to check if the
file is there first. If it is not skip the delete function. Thats the sytax I need.

Thu Dec 02, 2004 3:34 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7969

Post Re: File Exisits Reply with quote

For FileDelete your statement is correct, but for FileDeleteEx, FileMoveEx and FileCopyEx it is not. Last 3 methods simply report 0 files affected (this is their return value) but they don't trigger job error event.

: The problem I am having is not the copy file it is the delete file.
: Certian files will not be there every time the job is run. When I run the
: delete file code it throws a error. Thats why I need to check if the
: file is there first. If it is not skip the delete function. Thats the sytax I
: need.

Thu Dec 02, 2004 4:04 pm 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.