*! usesasdel Version 1.1 dan.blanchette@duke.edu  16Mar2009
*! Center of Entrepreneurship and Innovation Duke University's Fuqua School of Business
** usesasdel Version 1.1 dan_blanchette@unc.edu  01Feb2008
** - made the string comparison work for very long strings
** research computing, unc-ch
** usesasdel Version 1.0 dan_blanchette@unc.edu  09Nov2005
** the carolina population center, unc-ch

// can only delete files with no spaces in their names 
//  but can handle directory names with spaces in their names
program define usesasdel
version 8
  args dir basefilename 
       local files :  dir `"`dir'"' files `"`basefilename'*"' , nofail
       foreach f in `files' {
         local dirf `"`dir'/`f'"'
         if `: list local(dir) == local(dirf)' == 0 {
             erase  `"`dir'/`f'"'
         }
       }
 end

exit