home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast.iso / pcmag / vol10n21.zip / DEL1.PRG < prev    next >
Text File  |  1991-07-03  |  1KB  |  23 lines

  1. ***********************************************************************
  2. * DEL1.PRG                                               FoxPro 1.02
  3. * Delete all files specified by a wildcard expression.
  4. *
  5. * Example: DO Del WITH "c:\*.bak"
  6. ***********************************************************************
  7. PROCEDURE DEL
  8. PARAMETERS mWild
  9. PRIVATE mPath, mFile
  10.  
  11.   mPath = LEFT( mWild, RAT("\",mWild) )    && Extract path
  12.   IF ("" = mPath .AND. AT(":",mWild) <> 0) && If drive is specified
  13.     RETURN                                 && Without a full path
  14.   ENDIF                                    && Simply return
  15.                                            && Otherwise
  16.   mFile = SYS( 2000, mWild )               && Find first matching file.
  17.   DO WHILE ! EMPTY( mFile )                && Was a matching file found?
  18.      ERASE ( mPath+mFile )                 &&    Yes, delete it.
  19.      mFile = SYS( 2000, mWild, 1)          &&    Find next matching file.
  20.   ENDDO                                    && Repeat process.
  21.  
  22. RETURN
  23.