KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > TestCopy


1 import jcifs.smb.*;
2
3 public class TestCopy {
4
5     public static void main( String JavaDoc[] args ) throws Exception JavaDoc {
6
7         if( args.length < 1 ) {
8             System.err.println( "usage: TestCopy <from1> <to1> [<from2> <to2> [<from3 ...]]");
9             System.exit(1);
10         }
11
12         for( int i = 0; i < args.length; i += 2 ) {
13             try {
14                 SmbFile remote = new SmbFile( args[i] );
15                 if( remote.exists() ) {
16                     SmbFile local = new SmbFile( args[i + 1] );
17                     remote.copyTo( local );
18                 }
19             } catch( Exception JavaDoc e ) {
20                 System.err.println( args[i] + " -> " + args[i + 1] );
21                 e.printStackTrace();
22             }
23         }
24     }
25 }
26
Popular Tags