DupCheck v1.6 by Mark Montminy The Bloom Beacon BBS (401)751-3831/6568 I don't know about other sysops, but I can't stand duplicate uploads to my BBS. Once my BBS was running smoothly under DLG, I set out to write a dupe checker that could be run after every upload. When run from DLG's Upload.batch or ReceivedFile.Batch, DupChecker does just that. DupCheck does nothing with duplicate file, it simply tests for it, and returns with a return code of WARN (5) which can be tested for in a simple AmigaDos script, or an Arexx script. It's up to you to do whatever with the file. DupCheck also skips any private uploads (and there was much rejoicing). It won't even give any indication to the user that it was run. DupChecker has 2 methods of searching for duplicate files, using an index, or using FILE:*/file.dat. The index method flat out screams thanks to Luca Spada's index system used by SkyFreq. The same index was used for 3 simple reasons, 1) why reinvent the wheel 2) why consume extra disk space 3) I'm too lazy to create my own. To use the index, call DupCheck with a -i indexname argument. The disadvantages to the index method, 1) Makeindex seems to require a fair amount of memory making it unusable by some systems 2) areas not flagged for FREQ's are not included in the index, thus not compared for dupes. The default search mode is non-indexed using DLG's file.dat files. This method is considerably slower, and requires more memory, but less than MakeIndex. It's usefull on systems that don't have many file areas, or alot of files. I've optomized it as best I know how, and I find it better than no dupe checking at all, which is why I've re-added it to the code as an option for those tight on memory. File extensions are stripped before comparison in attempt to catch files compressed with different archivers. Extension stripping can be disabled via the -x option. Non-alphanumeric characters (.,/@# etc) can also be stripped by using the -a option. When a duplicate is found, the file/s in question is displayed to the user, and the search continues through the remaining areas. A file called T:DupCheck.Tmp is created listing all the duplicate files found. When DupCheck is finished, it will exit with a return code of 5 (WARN) which can be tested for in your batch file and the appropriate action taken. It also creates 3 environmental variables if a dupe was found: DUPAREA the file area this file was uploaded to DUPFILENAME the name of the file being tested DUPUPLOADER the name of the user who uploaded it Inluded in this archive is my Upload1.Batch. It's not fancy, but it does what I wanted. It sends my sigops email if any duplicate files are uploaded to thier sig. There are probably dozens of things you can do. DupCheck is CopyRight 1993 by Mark Montminy. You are free to distribute and use this at will, but I retain all rights to it. If you use and enjoy this program, I encourage you to support shareware by registering something you have! If you're all registered with everything, feel free to send a few bucks my way, you're obviously a generous person :) Shameless plug alert, Hack & Slash and EmacsDLG are 2 excellent programs worth registering!! Changes: v1.6 - made the filename optional (-n). If no filename is given, dupcheck will prompt for one. Now you can run it as a door and users can dupcheck their uploads before uploading!! v1.5 - Much nicer coding :) Added ability to use index or file.dat. Implemented subindexing when using indexing for a HUGE performance gain. Added the ability to strip non-alphanumerics. v1.4 - (never released) No longer checks private uploads. v1.3 - Changed to use the index files created by MakeIndex. Output format has changed as well. v1.2 - Not much really. Changed the output a tad to put the filename in uppercase surrounded by [] to conform to the look of DLG. Played with buffering to increase speed, but there was no gain so it was left at 100.