/* ------------------------------------------------------------------ */ /* Macro: SUPERDEL.AML 'Super Delete' */ /* (WARNING: this macro can be very dangerous!) */ /* Written by: nuText Systems */ /* */ /* Description: This macro deletes the file or directory at the */ /* cursor in the current file manager window. This */ /* macro will delete entire directories, including */ /* all subdirectories and protected files. This macro */ /* can be very useful for removing complex directory */ /* structures which are no longer in use. */ /* */ /* Usage: To use this macro, place it in the MACRO */ /* subdirectory, compile, and run from the macro */ /* picklist , from within a File Manager */ /* window. NOTE: the pickmacro command */ /* MUST be placed in the "edit_fmgr" object in KBD.AML. */ /* ------------------------------------------------------------------ */ // compile time macros and function definitions include bootpath "define.aml" // delete the current directory and all subdirectories function deletedir (directory) // get a directory listing if loadbuf directory '' '' "dh1" then // do recursively for all subdirectories repeat name = qualify (getffile) directory if dir? name then // don't go back to the parent directory if (sizeof name) > (sizeof directory) then deletedir name end else // delete the file even if it's read-only if not (deletefile name) then chgfileattr name deletefile name end end until not down destroybuf // delete this directory deletefile (getpath directory) end end // file manager windows only if not wintype? "fmgr" then msgbox "File Manager windows only!" return end // delete a file or directory function delmarked (file) if dir? file then deletedir file else // delete the file even if it's read-only if not (deletefile file) then chgfileattr file deletefile file end end end marked = fmark? file = qualify (getffile) (getbufname) // check for confirmation if (icompare _ConDel 'n') or (icompare (popup "ok" "Super Delete" + ' ' + (if? marked "MARKED FILES/DIRECTORIES" file) + '?') "ok") then // marked files if marked then fdomark "delmarked" // file or directory at the cursor else delmarked file end // refresh fmgr window contents reopen end