nivparsons
Technical User
I have sets of files in numbered directories, one set is copied to a working directory & used as needed. However, I would like to somehow store the number of the directory, so if the user requests the same index as is currently in the working directory, no copy is performed; or, if a new set is selected, then that new number is stored in place of the old one.
At the moment, I open a file (in r mode) with just a 3 digit value in it, which I open to read, check if it's equal to the selected one, skip copying if same, else close the file, open it again (in w mode) and write the new index before closing it agian, finally doing the file copy.
This seems a very untidy way of storing/updating the index, any suggestions for a better way please?
At the moment, I open a file (in r mode) with just a 3 digit value in it, which I open to read, check if it's equal to the selected one, skip copying if same, else close the file, open it again (in w mode) and write the new index before closing it agian, finally doing the file copy.
This seems a very untidy way of storing/updating the index, any suggestions for a better way please?