Listing files in directory


Can some one help us with the below scenario.

I have few text files with some content in the directory and now have to read content of all these files in that directory and need to write it to single file.


Hi Arjun,

To read the contents of file, getFile in-bulit service can be used.


And to write, you can use pub.file:streamToFile or pub.file:stringToFile with append set to ‘true’.


Hi Senthil,

Thanks for your quick response.
Here first thing is how to list all the files in a directoy,before read.If we have list then we keep those list in loop and we can read and write each file.

one more thing am unable to see these pub.file:streamToFile or pub.file:stringToFile two services .do we need to install any plug-in or they will be included in IS installation.

I am using IS 7.1

PSUTILITIES package contains listFIles service to list files in a service…or else u need to create a Java service for this…

streamToFile and stringToFile services are available from 8.x not in 7.x. You have to write custom java service in your environment. As suggested you can look into PSUtilities to see if it has services already built into it…