| 1. |
Solve : Need help with finding a string in a file and then . . .? |
|
Answer» Our translation software translates a file and then writes it to a specific folder. The batch file I'm writing needs to rename the file, but first, needs to determine if the file translation is finished before I try to do anything else, so, I need to first loop through the first file in a folder, look for the string 'end of file'. The translation software should have the file "open" and therefore unable to edit when it is writing to it. Is this statement not true in this case? If so, why?Whether a file is open has no bearing whatsoever on whether the file can be CHANGED. That depends on the dwShareMode parameter that was used when the file was opened, which is usually as lax as possible. In this case the ShareMode would have to include FILE_SHARE_DELETE to allow renaming the file. In any case, my point is that whether a file is open is entirely separate from whether it can be opened, read, written, renamed, or deleted. Quote from: BC_Programmer on November 23, 2011, 02:04:15 PM In any case, my point is that whether a file is open is entirely separate from whether it can be opened, read, written, renamed, or deleted. Right. Again, BRAIN too involved with visions of turkey INDUCED coma in very near future. In any case, this post shows how to use the tasklist command to see if a program is running. It may provide a more accurate assessment of whether the translator program is running or not. |
|