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
/
cp.bsh
< prev
next >
Wrap
Text File
|
2005-05-23
|
474b
|
21 lines
/**
Copy a file (like Unix cp).
*/
bsh.help.cp = "usage: cp( fromFile, toFile )";
cp( String fromFile, String toFile )
{
this.from = pathToFile( fromFile );
this.to = pathToFile( toFile );
this.in = new BufferedInputStream( new FileInputStream( from ) );
this.out = new BufferedOutputStream( new FileOutputStream( to ) );
byte [] buff = new byte [ 32*1024 ];
while ( (len = in.read( buff )) > 0 )
out.write( buff, 0, len );
in.close();
out.close();
}