Wipe all files
The following is a simple recursive file-wipe program that prompts Yes/No/All to delete each file or directory. It deletes everything in the selected directory, including the selected directory itself.
REM > Wiper 1.00 : DIM ctrl% 31,name% 31:X%=ctrl%:Y%=X%DIV256 : INPUT "Directory to wipe: "fn$ path$="":conf%=TRUE:A%=FNdelete END : DEFFNdelete LOCAL empty%,access% PRINT "Delete ";path$;fn$;:conf%=FNyna(conf%):IF conf%>0 THEN PRINT:=FALSE type%=FNfile(fn$,5):access%=X%?14:empty%=TRUE:PRINT IF type%=2 THEN OSCLI "Dir "+fn$:empty%=FNwipe:OSCLI "Dir ^" IF empty% THEN IF (access%AND8)<>0 THEN OSCLI "Access "+fn$ IF empty% THEN OSCLI "Delete "+fn$ =empty% : DEFFNwipe path$=path$+fn$+".":empty%=TRUE LOCAL fn$,idx%,oldidx% REPEAT oldidx%=idx%:fn$=FNgbpb8(idx%):idx%=X%!9 IF fn$<>"" THEN done%=FNdelete:empty%=empty% AND done%:IF done% THEN idx%=oldidx% UNTIL fn$="" REM Note, 6502 BASIC only REPEATS to 20 levels REPEATpath$=LEFT$(path$,LENpath$-1):UNTILRIGHT$(path$,1)="." OR path$="" =empty% : DEFFNyna(A%):IFA%=0:=0 PRINT "? (Y/N/A)";:REPEAT:A%=INSTR("YAN",CHR$(GETAND&DF)):UNTILA% PRINTSTRING$(7,CHR$127);MID$("YesAllNo ",A%*3-2,3);:=A%-2 : DEFFNfile(A$,A%):$name%=A$:?X%=name%:X%?1=name%DIV256:=(USR&FFDD)AND&FF DEFFNgbpb8(ptr%):X%!1=name%:X%!5=1:X%!9=ptr%:A%=8:CALL&FFD1:IFX%!5=1:="" A%=name%+1:A%!(A%?-1)=&D20:A%?(INSTR($A%," ")-1)=13:=$A%
Jgharston 04:09, 12 August 2012 (UTC)