rem Finds out if PCTODAY.EXE is found on your path.
iff "%@search[pctoday.exe]" =="" then
beep
text
This batch needs PCTODAY.EXE (c) by Ethan Winer
(downloadable from SIMTEL20: <msdos.pcmag>VOL10N21.ZIP)
endtext
quit
endiff
iff %@index[%1,h] ge 0 .or. %@index[%1,?] ge 0 then
goto help
elseiff %@index[%1,i] ge 0 then
goto help_i
endiff
:compu_name
if "%compuname"=="" gosub compuname
setlocal
:set_temp
if "%temp"=="" gosub setramd
: (temporary drive will be defined %_lastdisk if it is not remote
: or cd-rom drive.)
if not direxist %temp (set temp=^gosub setramd)
iff "%@substr[%temp,0,-1]" == "\" then
set temp=%temp%
else
set temp=%temp\
endiff
iff %@index[%1,x] ge 0 then
goto extract_f
endiff
gosub check_args
iff %@index[%1,/s] ge 0 .or. %@index[%1,-s] ge 0 then
set zz=%@substr[%1,2]
goto _date2
elseiff %@index[%1,s] eq 0 then
set zz=%@substr[%1,1]
goto _date2
else
goto _date1
endiff
:set_defaults
:_date1
set xx=%@date[%_date]
: This is today'y date in full numbers since 1-1-1980
set zz=%@makedate[%@eval[%xx-%1]]
: This is the actual date desired for the archive file.
: If no number of days indicated by user, you get today's
: date again.
if %@index[%zz,0] eq 0 set zz=%@substr[%zz,1]
: If a zero (0) is contained on the first position (01, etc.),
: it will be removed.
:_date2
set rsp=%temp%updates.rsp
set zipfn=%temp%updates.zip
set tmpf=%@unique[%temp]
if exist %zipfn del /q %zipfn
rem (This is just a precaution; this file is moved anyway, if batch
rem terminates in a normal way.)
:modifiables
rem ==> Modify any of the following variables to your preference.
set exclude=-x*.tmp -x*.00? -x*.bak -xpctoday.* -x*.zip -xkermit.*
rem (filepatterns excluded from updating)
set dr=%archive_drive
iff %@index[%dr,:] eq 1 then
set dr=%@substr[%dr,1,-1]
endiff
rem ('archive_drive' was determined by the 'checking drives' subroutines.
rem This is the drive for the final ZIP archive; the temporary file will
rem be created on your 'temp' drive, if it exists, else on deafult
rem drive.)
set pkz=pkzip -P -ex
rem (archiving with pathnames; erase '-P' if no pathnames desired)
set colordir=dirs:bright white;zip:black on white;
set edt=ped.exe
rem ^^^^^^^ (replace ped.exe by your preferred editor)
:re-use?
cls
if exist %rsp goto ask
goto accumulate
:ask
echo.
gosub legenda
screen 2 0
inkey /K"YNVESQ" Use extant list file? (created %@filedate[%rsp], at %@filetime[%rsp])? [time now: %_time]n (List File is: %@upper[%rsp])nnType Y/N, V(iew), S(creen), E(dit), or Q(uit) %%rep
iff %rep == Q then cls^screen 2 0^set ech=echo Stopped by user^ goto end
elseiff %rep == Y then goto backup
elseiff %rep == V then *list %rsp^cls^goto ask
elseiff %rep == E then %edt %rsp^goto backup
elseiff %rep == S then echo. >%tmpf^cls^set num=0^goto edit
elseiff %rep == N goto accumulate
endiff
:accumulate
cls
iff %_monitor == mono then
screen 4 5 [ making a list of all new files created since %zz ]
screen 3 5 Working ...
else
scrput 4 5 gre on whi [ making a list of all new files created since %zz ]
scrput 3 5 blu on whi Working ...
endiff
:make_list
pctoday %search_drive: /d %zz > %rsp
rem (Pctoday's syntax is: PCTODAY [D:] [/D mm-dd-yyyy] [> filename.ext])
iff %@lines[%rsp] lt 0 then
set ech=scrput 3 17 bri whi on bla No files were found for/since %zz!
del /q %rsp
goto end
endiff
scrput 3 17 bri whi on bla List created as %@upper[%rsp]
:edit?
screen 6 5 Select an option (press first letter):
screen 7 5
text
Screen select files on screen (one file after another)
(this option allows viewing and deleting)
Edit edit results file via editor
View view results before making any decision
Go go to immediate archiving (no selection)
Quit stop now (results file will remain intact)
endtext
screen 16 3
inkey /K"SEQGV[ESC][Enter]" Your choice? %%rep
iff %rep == G then goto backup
elseiff %rep == S .or. %rep == @28 then
echo. >%tmpf
cls
set num=0
goto edit
elseiff %rep == E then
%edt %rsp
goto backup
elseiff %rep == V then
*list %rsp
cls^goto edit?
elseiff %rep == Q .or. %rep == %@char[27] then
set ech=echo Stopped by user^goto end
endiff
:edit
rem This procedure displays all the files saved today, one by one,
: allowing you to (a) select only those you wish to back up, or
: (b) delete, or (c) view a file before making a decision, or
: (d) view the list of selections, or (e) stop selecting and go
: to immediate archiving, or (f) quit.
:
iff %@eval[%num] gt %@lines[%rsp] then
move /q %tmpf %rsp
goto backup
endiff
set fn=%@line[%rsp,%num]
if .%fn==. (set num=%@eval[%num+1]^goto edit)
scrput 0 0 black on white Accept=A/enter Omit=O/Esc D=Delete V=View G=Begin archiving L=View list Q=Quit