Creating an empty text file using FS Write Operation

I need a way to create an empty text file without any newlines or anything.  I'm trying to use the COUNT result to bring back the number of lines in the file as I write to it.  The initial creation of the file should be empty without any lines.  However, it looks like it returns a COUNT = 1.0.  I am writing this file to my Central Windows 2008 server.


Inputs are as follows:

file = \\${centralHost}\c$\Temp\somefilename.txt

user = systemaccount

password = systemaccount

delimiter = blank

overwrite = true

characterSet = blank


This is 9.05/Content Pack 9.


Any ideas?

  • Hi,


    This should be pretty easy to workaround, although the answer may differ based on my query below.


    Are you using the /lib/FileSystem/Windows Only/Write to File operation? I don't have a "COUNT" result on either the Windows or Cross Platform 'Write to File' operations and I'm running 9.05 CP9 as well. I only have a "COUNT" result on the 'Read File' operations.


    Or are you using a "Line Count" result filter on the contents?


    Are you sure the contents and delimiter inputs aren't inheriting a value from a previous variable? Although the 'Use Constant' may be blank that will be ignored if the 'assign from' variable actually has a value.


    If you can give a little overview of what you're trying to achieve as well, any solution I can give will be better tailored.




  • I figured it out.  It all has to do with the delimiters and characterSet usage. I used this to get it to work:


    /Library/Operations/File System/Windows Only/Write to File



    contents = nothing

    delimiter = nothing

    overwrite = true

    characterSet = US-ASCII


    This creates an empty text file.


    Now, as my steps execute successfully I write a step number to this file using the /Library/Operations/File System/Windows Only/Write to File operation with these settings:

    contents = "step number like 1 or 2 or 3...."

    delimiter = "\n"

    overwrite = false so it will append

    characterSet = US-ASCII


    To determine if step has successfully completed on future runs I use /Library/Operations/File System/Windows Only/Read File to read the file which returns COUNT for number of lines in the file.  I use logic to determine if the step has executed previously with success based on this COUNT.


    This allows me to Run, Skip, or Force Skip a step for error handling.