Hi folks,
I am trying to check filename whether exists or not in the local file system.If file doesn’t exist I need to create a file in that name.How I have to do that?
There are at least two ways to do this:
-
Use WmPublic.pub.file:head with skipLines set to a very large number, like 9999. (You could instead set showLines=1; zero will read the whole file.) It will throw an exception if the file does not exist, so set up a try/catch block with sequences.
-
A better way is to download and install PSUtilities from Advantage. It has a flow, PSUtilities.file.checkfileExistence to do just this. A bonus is you get a lot more useful utilities.
Howard