Blame view

src/idl_misc/JPBLib_for_Dustemwrap/General/wait4file.pro 523 Bytes
6db3528a   Jean-Philippe Bernard   adding librairies...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
PRO wait4file,file

;wtime=0.1
wtime=1.
message,'Waiting for file: '+file,/info
;will wait until the specified file exist and is finished writing
count=0
WHILE count EQ 0 DO BEGIN
;  files=find_files(file,count=count)
  files=file_search(file,count=count)
  wait,wtime
ENDWHILE

prev_size=0.
finfo=file_info(file)
size=finfo.size
WHILE size NE prev_size DO BEGIN
  wait,wtime
  prev_size=size
  finfo=file_info(file)
  size=finfo.size
  message,'size='+strtrim(size,2)+'prev_size='+strtrim(prev_size,2),/info
ENDWHILE

END