You can use the Jython file system object to process files and folders. The following example uses the file system object to create a file and to copy the contents of an existing file to the new file.
Read the following Input File Entity,Currency,ICP,Product,Store,Channel,Custom4,Custom5,Custom6,Custom7,UnitsSold,Sales EastSales, USD, [ICP None], H740, Comma_Phone_Stores, Retail_Direct, [None],[None],[None],[None],127,9954.103768 EastSales, USD, [ICP None], H740, Freds, National_Accts, [None],[None],[None],[None],112,6610.371552 EastSales, USD, [ICP None], H740, Good_Buy, National_Accts, [None],[None],[None],[None],112,6610.371552
Write the following Output File EastSales, USD, [ICP None], H740, Comma_Phone_Stores, Retail_Direct, [None],[None],[None],[None],UnitsSold,127 EastSales, USD, [ICP None], H740, Comma_Phone_Stores, Retail_Direct, [None],[None],[None],[None],Sales,9954.103768 EastSales, USD, [ICP None], H740, Freds, National_Accts, [None],[None],[None],[None],UnitsSold112 EastSales, USD, [ICP None], H740, Freds, National_Accts, [None],[None],[None],[None],Sales6610.371552 EastSales, USD, [ICP None], H740, Good_Buy, National_Accts, [None],[None],[None],[None],UnitsSold,112 EastSales, USD, [ICP None], H740, Good_Buy, National_Accts, [None],[None],[None],[None],Sales,6610.371552
infilename = fdmContext["INBOXDIR"]+"/InputFile.txt" outfilename = fdmContext["INBOXDIR"]+"/DataFile.txt" infile = open(infilename, "r") outfile = open(outfilename, "w") for line in infile: column = line.rsplit(',',2) if column[2].strip() != "Sales" : outfile.write(column[0] + ",UnitsSold," + column[1] + "\n") outfile.write(column[0] + ",Sales," + column[2]) outfile.close()