4DOS Trasher V1.0 - by Gino Branzino in 1996 WHAT IS THIS ? ============== As the name itself implies, Trasher is a little .btm which allows a simple management for files to be deleted - a command-line version of the trashcan you can find in many GUI OSes. Of course if you are stick to a GUI OS this is pretty useless - I just wish you you're not using W**doze 95 :-( Don't take it too seriously: it's a twenty-minutes work done without even reading 4DOS batch programming documentation, so it will likely seem ingenuos (at the least) to experienced btm programmers (btw, is there any way to create variables local to the .btm execution ? I had to use global ones and then to unset them - a pretty bad solution !!). It's a very simple program, anyway I think it can be very useful. INSTALLING ========== Just copy trash.btm into a directory of your PATH, and set the environment variable TRASH to point to the directory that will contain the deleted files (an hidden directory would be nice). (4DOS newbies: add the line set TRASH=drive:\directory to your 4DOS.ini file, and attrib +h the directory). Any version of a 'touch' program is required to be in your PATH also. You can find many versions on Simtel (dirutils). USING TRASH =========== Usage: trash [[filename][...]]|[/s]|[/c n] - if you specify one or more filenames (up to 9), the selected files will be moved to the directory specified in TRASH and their date will be changed to the current date; - option /s will tell you how much space does the thrash take and how old is the oldest file; - option /c followed by a number will delete all the files older than n days. So you normally trash instead of deleting the files you don't need anymore. If you want to recover a trashed file you just copy it from dir TRASH. When you run short of disk space all you have to do is deleting the oldest files from trash (for example you could 'trash /c 180' periodically to delete all files trashed more than 6 months before). Warning: don't mix directories and files as arguments to trash !! To keep it simple, trash will look for the type of the first argument (file/dir) and then use move or move /S accordingly - using /S for moving files duplicates the names of all the subdirs found in the current dir to the trash directory. If you gave, say, a dir a first argument and a file as second you could see something strange happen... so just issue separate 'trash' commands for files and dirs... SHORTCOMINGS ============ OK, don't bother me... this batch is far too simple to even distinguish one defect from another :-), but I didn't want to spend more time on it. These are the main 'unfeatures': - clutter support for subdirectories: trashing a directory won't create the directory in trash, but will move all its files (including subdirs contained in the specified dir) to the first level of dir TRASH; this means that you loose the first level of dir (in case you tried to recover it). It's a fault of messy-DOS move command which doesn't have a good support for subdirs (let's say it has no support at all, the /S switch is a loosy patch) (Linux & AmigaOS rule !!); - the /S switch in the move command causes all the subdirs in the current dir to be copied to trash; to avoid this problem while still handling some kind of subdir trashing, the /S switch will be used only if the first argument is a directory. This causes the problem above mentioned when mixing files and dirs on the same 'trash' command. An easy solution would be to check every single argument and use separate 'move' commands - but that would be too much work for a lazy project like this. Who cares anyway ? - parameter handling is too simple, offers quite no protection against typing errors, and limits the number of files that can be specified on command line to 9 (although this is easily fixed); - trashcan stats just prints out the total size of TRASH and name and description of the oldest file - furthermore the lattest requires a lot of time if many files are in trash; - add your own complaint here. POSSIBLE ENHANCEMENTS ===================== There's always one more enhancement... here is my to-do unsorted list: - better support for subdirs; - better parameter handling; - faster and more detailed trashcan stats; - some kind of data compression (using a slow but highly efficient packer); - a nice way to recover data from trash ('select copy (%TRASH\*.*)' ain't that nice); - some kind of automatic trash cleaning based on current date. I don't think I will have time (and will) to do any of the above, surely not in the near future. If some willing voluntary feels like he has time to waste and comes out with a better version (easy task !! :-) I would like to get it. 'NO COPYRIGHT' INFORMATION ========================== Copywhat ? It's just a bunch of batch commands stuck together without any apparent logic :-) - you are free to make whatever you like of it: copying, modifing, trashing :-), or paying me a nominal fee of $5000 (not less). AUTHOR ====== You can reach Gino Branzino at: s151329@studenti.ing.unipi.it insol@mbox.vol.it Feedback, suggestions and fierce critics are well accepted.