Append to Text File (Log) - Unique entries only
I am able to create a text file log and append to it (code below). I am writing file names to it as I save them. If for some reason I need to resave the file, I don't want to duplicate the entry in the log.
Can the ammend process include checking existing entries in the log and only appending only if it doesn't exist. I'm only expecting a maximum of 1000 file names per log. The script is called by another script so it will have to evaluate the entries each time it runs before appending. I'm guessing Photoshop would have to load existing linesinto an array and compare the test to be written.
I'm on OS X Catalina 10.15.7 using CC 2021 and 2022
Could someone please help with this code?
Cheers!
Limey
//Write Log File
var fname = fileName;
var a = new File(logsFolder + "/processed_" + todaysDate + ".txt");
a.open('a');
a.write(fname + "\n");
a.close();
