Search found 8 matches

by doshelp
18 Sep 2015 14:38
Forum: DOS Batch Forum
Topic: Detecting a true zero byte file and not a file being written
Replies: 21
Views: 11791

Re: Detecting a true zero byte file and not a file being wri

Good update. You were right. I intorduced a second nested loop and did some testing. The initial for loop size value remains zero but when you execute a nested loop and reexamine the file size it will correctly return the file size if the file has completed writing. This may be a combination of the ...
by doshelp
10 Sep 2015 11:19
Forum: DOS Batch Forum
Topic: Detecting a true zero byte file and not a file being written
Replies: 21
Views: 11791

Re: Detecting a true zero byte file and not a file being wri

I think what is happening is when the file attributes get assigned to "j" in this for loop [[ %%j in ("\\ahacct01\File-Exchange\APInvoices\*.xml")]] the file attributes become static. So no matter how long I wait checking the file size of "j" is always going to be zero ...
by doshelp
10 Sep 2015 11:08
Forum: DOS Batch Forum
Topic: Detecting a true zero byte file and not a file being written
Replies: 21
Views: 11791

Re: Detecting a true zero byte file and not a file being wri

to use TYPE and DIR on a networked UNC path I needed to add the pushd command to create a temporary virtual drive for syntax. Then you do not need to use the full Network Path for any of your other commands because your working directory is that Network Path. Type and DIR both work with UNC paths s...
by doshelp
10 Sep 2015 09:44
Forum: DOS Batch Forum
Topic: Detecting a true zero byte file and not a file being written
Replies: 21
Views: 11791

Re: Detecting a true zero byte file and not a file being wri

Here is the new code I added some output to better be able to follow what is going on. I needed to add some more IF Exist checks. There is a process that moves these files out of the directory every 15 minutes and if the file was moved during the 30 sec wait then it was creating a false positive. to...
by doshelp
09 Sep 2015 11:48
Forum: DOS Batch Forum
Topic: Detecting a true zero byte file and not a file being written
Replies: 21
Views: 11791

Re: Detecting a true zero byte file and not a file being wri

I will look into a more elegant solution for now I learned something. I was watching the file creation today and I noticed one take about 10 seconds to finish. In the past I always witnessed it in 2-3 seconds. I increased my pause time in my loop to 30 seconds so now if it detects a 0 byte file it w...
by doshelp
09 Sep 2015 08:50
Forum: DOS Batch Forum
Topic: Detecting a true zero byte file and not a file being written
Replies: 21
Views: 11791

Re: Detecting a true zero byte file and not a file being wri

I will do some testing. I think what is happening is the application creates a zero byte file and then writes the content to it. The file does not seem to get assigned a file size until the write process is completed. so the short window that a file is being written to my script thinks it is a zero ...
by doshelp
08 Sep 2015 09:17
Forum: DOS Batch Forum
Topic: Detecting a true zero byte file and not a file being written
Replies: 21
Views: 11791

Re: Detecting a true zero byte file and not a file being wri

Thank you that code works but I am finding out that the application that writes these XML files is not issuing a lock so the script is returning the result as if it is unlocked for writing. I tried to tweak the code so that it pauses and checks the file again after 10 seconds. It normally takes the ...
by doshelp
04 Sep 2015 10:58
Forum: DOS Batch Forum
Topic: Detecting a true zero byte file and not a file being written
Replies: 21
Views: 11791

Detecting a true zero byte file and not a file being written

Hello this may not be a solveable problem but I wanted to ask. I wrote a batch file to monitor a directory for any files that equal Zero bytes. We have an application that occasionally errors and creates a zero byte xml file. When it does it stops a system routine from importing from that directory....