I have a fairly long script that does a number of file/directory create/reads/writes. for a number of them, i check if it exists then if it doesn't I create it. if it does exist, i just delete it's contents to start fresh. here is a sample of the code:
Code: Select all
my question though is around the sleep command. if i wanted to optimize this code to run as fast as it can thru the script, i'd shorten down the sleep pauses as much as possible. question: is there a faster way to confirm a file/directory is ready for writing or appending instead of just using an arbitrary sleep pause time? If i set the sleep command too short, sometimes my later commands get messed up because the system isn't ready.