home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / CMCD0404.ISO / Software / Shareware / Comunicatii / advwebrank / awr.msi / disk1.cab / bsh_1.2b6.jar / bsh / commands / rm.bsh < prev    next >
Encoding:
Text File  |  2002-05-26  |  344 b   |  21 lines

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