1 import jcifs.smb.SmbFile; 2 3 public class SmbTimeout { 4 5 public static void jcifsScan(String root, int sleepTime) throws Exception { 6 long start = System.currentTimeMillis(); 7 SmbFile smbRoot = new SmbFile(root); 8 SmbFile[] files = smbRoot.listFiles(); 9 for(SmbFile f : files) { 10 System.out.println( f + ": " + f.canRead()+" : "+ f.length() + ": " + (System.currentTimeMillis()-start)); 11 Thread.sleep(sleepTime); 12 } 13 } 14 15 public static void main(String [] p_args) throws Exception { 16 if(p_args.length!=2) { 17 System.out.println("Usage: <smbroot> <sleeptime(ms)>"); 18 return; 19 } 20 String smbRoot = p_args[0]; 21 int sleepTime = Integer.parseInt(p_args[1]); 22 jcifsScan(smbRoot,sleepTime); 23 } 24 25 } 26 | Popular Tags |