I am using Connect:Direct process to run a DOS command to get the list of files available for collection.
If the files are available in the collection folder then the file details gets redirected to the output file (dirfile.lst)
. Then Connect:Direct will do a collection for those files and then delete dirfile.lst.
If there are no files in the collection folder it is expected that the dirfile.lst will be empty. And Connect:Direct will collect no files and delete dirfile.lst.
The command which I am using is
(dir "G:\Outbound\EDI\USCOLL_FTP\*" /a-d/oN ) > "F:\Sterling\Connect Direct v4.6.00\Server\program\2172047.dirfile.lst"
The problem which I am facing is when the file filter is .
or *.*
and if there are no files in the folder then the command throws a response "File Not Found". Connect:Direct process fails when it gets any response from the command. Interestingly I only face this issue is the file filter is . or * for any other file filter I am not getting this "File Not Found" response even though there are no files in the folder.
If I use 2> Null
to fix the issue it won't display any other exceptions, hence I don't prefer to use this?
Is there a way I can get rid of File not Found message which I get when I use * and . file filters?
Any help or suggestions will be much appreciated.
It's not pretty, but this should do the trick:
I know you didn't want to use
2>Nul
but it's the best I could get. Hopefully someone will provide a better answer.