Page 1 of 1

Server Routine to check whether the file exist or not

Posted: Mon Mar 28, 2011 6:28 pm
by SURA
Hi All

Need: I need to know whether a file is exist in a specific dir. If exist i need to create a .ok file.

Is there is any way to do or Can try to open the file like below and if the below command is suceed, then i can create a .ok file.

SeqFiles = File Path
OpenSeq SeqFiles: aFileName TO Jname


Please guide me.

Thanks
DS User

Posted: Mon Mar 28, 2011 7:20 pm
by ray.wurlod
The OpenSeq statement will take its Else clause if the file does not exist.

Note that the file will be open for writing and locked - you will still need a CloseSeq statement once you have performed your test.

You could also call DSExecute to execute a UNIX test -f pathname command (yes, even though you're running on Windows).

I will close it

Posted: Mon Mar 28, 2011 7:44 pm
by SURA
Thanks Ray

I will close the file. But is it the only way to find the file? Any other command is there to check?

Regards
DS User

Posted: Mon Mar 28, 2011 7:57 pm
by ray.wurlod
Yes, and I included it in my response.

Posted: Mon Mar 28, 2011 8:41 pm
by chulett
A Sequence job with the Wait For File stage could do a simple existence check and (if found) trigger a job / routine / whatever to create your 'ok' file.