HELP - How to check file size in DOS 
Author Message
 HELP - How to check file size in DOS

(posted and mailed)

> Does anybody may give me a little help to build a piece of code that
> need to run in background and has to check if in a directory the total
> file size of some file is stable or is increasing.
> I need to do this because i have to move automatically data from a
> directory where some files arrive via FTP, so this directory cab be
> free. Checking this size, i know if data is still arriving or if the
> transfer has finished.

Besides being OFFTOPIC and not relating particularly to C,
this is a poor idea.  Network congestion, transients, or
host loading may cause the size of the output file to
temporarily stop growing even though it is not complete.
A failed transfer will also stop growing but the output
may be invalid and you don't want to process it.

One better method is for the sender to directly trigger processing
on the target system with something like REXEC.  If this is not
available, another common approach is for the sender to create
an additional marker file only after successfully storing (all of)
the data file; then a process on the server polls for these markers
and when found processes the related or specified data file.
Or the sender stores to one filename (maybe whatever.NOTYET)
and only when complete renames it to a name which the server
daemon is looking for.

But in any case determining file size, or the list of files in a
directory (if directories even exist) is implementation dependent,
and should be discussed on a group for the desired system.
If you know in advance the expected/possible filenames,
you can just try at intervals to fopen() each possible file.
If the fopen() succeeds, the file must exist; but if it fails,
it doesn't guarantee the file doesn't exist, there could be
other causes of error.  And the "wait a while" part is also
implementation dependent.  See section 19 of the FAQ,
in the usual places or /

- David.Thompson 1 now at

Sun, 25 Aug 2002 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Check the file size and number symbols in a file using C in Unix


3. checking file size

4. Checking file sizes

5. Need help in writing a function to check for valid DOS filename

6. DOS File Size from C Problem???

7. Help for the memory size in DOS

8. Help : Any simple method to check the existence of a file

9. HELP Needs to check if file exists on FTP server

10. newbie needs Borland DOS file help...

11. Help : Opening 25 files in DOS

12. HELP damaged dblspace dos files


Powered by phpBB® Forum Software