*---- Parses result of batch file backfast *--- dir 5544.555 >>e:\dbfs.txt *--- dir dbf\*.dbf >>e:\dbfs.txt *--- for each directory. The first entry just is a way to make the directory display (file 5544.555 will not exist) set talk off set echo off set excl on set safe off select 1 use alldbfs zap use tempIn zap appe from dbfs.txt sdf set filt to substr(f,1,10) = ' Directory' .and. at('\dbf',f)>0 go top replace all dir with substr(f,26,10) set filt to at('\',dir)>0 go top replace all dir with substr(dir,1,at('\',dir)-1) set filt to substr(f,1,1)<>space(1) replace all dbf with substr(f,40,12) set filt to at('.',dbf)>9 copy all to toolong dele all set filt to pack go top Mdir = space(8) do while .not. eof() if dir = space(8) replace dir with Mdir else Mdir = dir endif skip enddo set filt to dbf = space(12) dele all set filt to pack go top do while .not. eof() Mdir = rtrim(dir) Mdbf = rtrim(dbf) *set step on *set talk on *set echo on sele 2 Mtemp = 'c:\clients\'+Mdir+'\dbf\'+Mdbf use &Mtemp copy stru exte to temp use DBftemp excl zap appe from temp replace all dir with Mdir,dbf with Mdbf use alldbfs appe from dbftemp select 1 skip enddo close data select 1 use alldbfs do while .not. eof() Mdir = dir Mdbf = dbf Mdbfroot = substr(dbf,1,at('.',dbf)-1) Mtemp = 'c:\clients\'+rtrim(Mdir)+'\stru\'+rtrim(Mdbfroot)+'.txt' ?Mtemp copy while Mdir+Mdbf = dir+dbf to &Mtemp sdf fields field_name,field_type,field_len,field_dec enddo quit