Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!floyd!whuxle!mit-eddie!genrad!decvax!ittvax!sii!wje From: wje@sii.UUCP (Bill Ezell) Newsgroups: net.sources Subject: summarize files in a directory Message-ID: <394@sii.UUCP> Date: Sun, 5-Feb-84 15:13:09 EST Article-I.D.: sii.394 Posted: Sun Feb 5 15:13:09 1984 Date-Received: Wed, 8-Feb-84 10:04:26 EST Lines: 39 b Here is a simple program for keeping track of files in a directory. It keeps a list of files and a one line description for each, and compares this list to the actual directory contents when it's run. If a new file has been added, it asks for a one line description. If a file has been deleted, it removes the entry from the list of files. It is written in AVL, but can probably be implemented in C without too much work. Anyone else have other quick but useful programs like this? -Bill Ezell, Software Innovations, Inc. (decvax!sii!wje) (ittvax!sii!wje) ______________________ main() /* keep a summary of files in a directory */ { pipe("ls","r",fd); /* see what files we have */ while( sread(fd,line) ) if( line $!= "^summary" ) new[line] = True; close(fd); foreach(node,new) /* compare new list to old */ { name = this(node); /* the subscript name */ if( !exist(^summary[name]) ) /* a new file */ { printf("Description of file '%s'? ",name); input(line); node = line; } else node = ^summary[name]; /* already defined */ } ^summary := new; /* update record */ printf("Summary of files:\n\n"); /* we could have done this above */ foreach(node,new) printf("%s - %s\n",this(node),node); exit(0); }