home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 June / PCWorld_2007-06_cd.bin / multimedia / ppsee / PPSeeSetup.exe / lib / bsh-commands-2.0b4.jar / bsh / commands / rm.bsh < prev    next >
Text File  |  2005-05-23  |  353b  |  22 lines

  1. /**
  2.     Remove a file (like Unix rm).
  3. */
  4.  
  5. bsh.help.rm = "usage: cd( path )";
  6.  
  7. boolean rm( String pathname ) 
  8. {
  9.     this.file = pathToFile( pathname );
  10.  
  11.     if ( file == null )
  12.         throw new java.io.FileNotFoundException("pathname");
  13.  
  14.     if ( file.isDirectory() ) {
  15.         print( pathname + "is a directory" );
  16.         return;
  17.     }
  18.  
  19.     return file.delete();
  20. }
  21.  
  22.