I would like to know whether or not there is some way of marking a file to identify whether or not the file contains x.
Consider the following example:
During a batch conversion process I am creating a log file which lists the success / failure of individual conversions.
So the process is as follows:
- start conversion process
- create log file named batch_XXX_yyyy_mm_dd.log
- try to convert ‘a’
- write success to log file
- try to convert ‘b’
- write success to log file
- …
- try to convert ‘z’
- write success to log file
- close and persist log file
What I would like to be able to do is mark a file in some way that identifies whether any of the conversions logged in the file were unsuccessful.
I do not want to change the file name (visibly) and I do not want to open the file to check for a marker.
Does anyone have any ideas on how this could be achieved?
You can add file attributes in Java 7 through the java.nio.file.Files class.
So it would be possible to mark whether a file contains X using the
Files.setAttribute()method:And then check whether the file does contain X using the
Files.getAttribute( )method: