1 import jcifs.netbios.NbtAddress; 2 import jcifs.smb.*; 3 import java.util.Date ; 4 5 public class VerifyGuest { 6 7 public static void list( SmbFile dir ) { 8 try { 9 long t1 = System.currentTimeMillis(); 10 SmbFile[] files = dir.listFiles(); 11 long t2 = System.currentTimeMillis() - t1; 12 13 for( int i = 0; i < files.length; i++ ) { 14 System.out.print( " " + files[i].getName() ); 15 } 16 System.out.println(); 17 System.out.println( files.length + " files in " + t2 + "ms" ); 18 } catch( Exception e ) { 19 e.printStackTrace(); 20 } 21 } 22 23 public static void main( String [] argv ) throws Exception { 24 list( new SmbFile( "smb://miallen2/" )); 25 list( new SmbFile( "smb://miallen2/pub/", new NtlmPasswordAuthentication( "dom", "user", "pass" ))); 26 } 27 } 28 | Popular Tags |