TIP: Click on subject to list as thread! ANSI
echo: commo
to: ERIC GUS
from: CHUCK SEYBOLDT
date: 1995-05-21 07:45:00
subject: File strew macro

EG>  I'm sure it could simply by writing a quick macro...something
EG>  I need to start looking into [unless someone posts theirs.
EG>  {hinthint}] I have having to go thru my dir after d/ls and
EG>  sorting it all out.
Eric,
        It's more than a quick macro.
 {:strew_}                              ;start hold_dr distribution
         {comp %hold_dr} {ifco retu}    ;if %hold_dr is NUL, skip 
istribution
         {subs dw,1,2,%_dwt}            ;first two char of day-of-week
         {setv zn_exts,.zns.sou}                ;set exts move to %znpak
         {setv qw_exts,.qwk.olx.%dw?} {setv dw} ;set exts move to %qwkdr
         {setv pi_exts,.gif.rle.bmp.tif.pcx.jpg};set exts move to %picdr
         {setv dl_exts,.zip.lzh.arc.exe.dwc.zoo};set exts move to %dldir
         {comp hold_dr,%znpak}          ;does hold dir == ZIPnews packet dir
         {ifco-c ,mov_zns}              ;ifso, don't move ZNSs
         {comp hold_dr,%qwkdr}          ;does hold dir == qwk file directory
         {ifco-c ,mov_qwk}              ;ifso, don't move QWKs
         {comp hold_dr,%picdr}          ;does hold dir == Picture directory?
         {ifco-c ,mov_gif}              ;ifso, don't move GIFs
         {comp hold_dr,%dldir}          ;does hold dir == download dir
         {ifco-c ,mov_dl}               ;ifso, don't move ZIPs
         {setv move_f}                  ;clear last filename transferred
         {setv m_dir}                   ;clear move-to directory
         {setv f_match}                 ;clear match extension list
         {setv cn} {setv coun,0}        ;clear counters
         {setv zn_exts} {setv qw_exts}  ;clear strew extension definitions
         {setv pi_exts} {setv dl_exts}
         {retu}                         ;end hold_dr distribution
 {:mov_dl} {ifex %dldir\NUL,,retu}      ;no move unless dir exists
           {setv f_match,%dl_exts}      ;look for these extensions
           {setv m_dir,%dldir}          ;move to this directory
           {goto list_mov}
 {:mov_gif}{ifex %picdr\NUL,,retu}
           {setv f_match,%pi_exts}      ;each separate move-to directory
           {setv m_dir,%picdr}          ;needs extensions and where-to info
           {goto list_mov}
 {:mov_qwk}{ifex %qwkdr\NUL,,retu}
           {setv f_match,%qw_exts}
           {setv m_dir,%qwkdr}
           {goto list_mov}
 {:mov_zns}{ifex %znpak\NUL,,retu}
           {setv f_match,%zn_exts}
           {setv m_dir,%znpak}
           {goto list_mov}
 {:list_mov}
         {setv coun,1} {setv cn,1}      ;list and move counters
         {file %hold_dr\*.*}            ;get first filename in hold dir
 {:td_ext}
         {subs ext,-4,3,%_ffn}          ;extract file extension - with dot
         {inst f_match,%ext}            ;check .EXT for match
         {ifco-c add_mofn}              ;add to move list, incr %count
         {file-x %hold_dr\*.*}          ;get next filename
         {ifco td_ext}                  ;read to end of directory
         {comp coun,1}                  ;if no match return
         {ifco retu,mov_loop}           ;otherwise, goto mov_loop
 {:add_mofn}                            ;add_move_filename to
         {setv move_f%coun,%_ffn}       ;Commo variable space
         {incr coun} {retu}
 {:mov_loop}
         {comp cn,%coun} {ifco-e retu}  ;when done moving, return
         {setv-s move_f,move_f%cn}      ;expand move_f%cn variable
         {setv move_f%cn}               ; clear %move_f1 for example
         {incr cn}
 {:chkdup}{ifex %m_dir\%move_f,,ok_move} ;if file exists ...
!!!!!         {info-d5s0  Not moving %hold_dr\%move_f,
!!!!! that filename is already in %m_dir }
         {goto mov_loop}                 ;try next filename
 {:ok_move}
         {call sho_mov}
         {exec-n copy %hold_dr\%move_f %m_dir>NUL}  ;DOS copy and delete
         {ifex %m_dir\%move_f,,fail_move}
         {exec-n del %hold_dr\%move_f>NUL}
         {goto mov_loop}
 {:fail_move}
         {info-d2s0  No room in %m_dir for %move_f }
         {goto mov_loop}
 {:sho_mov} {comp sho_,n} {ifco retu}   ;subroutine - show file activity
         {info-d2s0  Moving %hold_dr\%move_f to %m_dir } {retu}
05/20/95   10:20                                        ChuckùS
-*-
 þ JABBER v1.3á1 #á021 þ Life:Fair :: Freedom:Socialism (I'll take freedom)
--- Opus-CBCS 1.7x via O_QWKer 1.1
---------------
* Origin: BlinkLink - Perceiving is believing! 412-766-0732 (1:129/89.0)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.