in reply to Combining Data Files

The files don't just appear. They grow as the FTP upload progresses. How do you expect to know when the files have finished uploading? Testing for their presense is not sufficient, as shown by my proof below. If you don't take this problem into account, you may end up with only a fragment of the first or second file in the combined file. The two solutions provided to date do not take this problem into account.

Proof:

$ cat a.pl open(FILE, '> bla') or die("$!"); select FILE; $|=1; select STDOUT; print FILE "test1\n"; print FILE "test2\n"; sleep 10; print FILE "test3\n"; close FILE; $ cat a.sh #!/bin/sh rm -f bla bla2 perl a.pl & sleep 5 test -f && cp bla bla2 sleep 10 echo bla: cat bla echo bla2: cat bla2 $ a.sh bla: test1 test2 test3 bla2: test1 test2

Replies are listed 'Best First'.
Re^2: Combining Data Files
by Anonymous Monk on Mar 23, 2005 at 19:19 UTC
    This is true. There are two problems. Both files may not appear in the directory on the same day. The process needs to determine if both files are in the directory and are intact. Then I need to cat one file to the other. If one or the other file is not present, I need to suspend the process (scheduler).