KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SmbTimeout


1 import jcifs.smb.SmbFile;
2
3 public class SmbTimeout {
4
5     public static void jcifsScan(String JavaDoc root, int sleepTime) throws Exception JavaDoc {
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 JavaDoc[] p_args) throws Exception JavaDoc {
16         if(p_args.length!=2) {
17             System.out.println("Usage: <smbroot> <sleeptime(ms)>");
18             return;
19         }
20         String JavaDoc smbRoot = p_args[0];
21         int sleepTime = Integer.parseInt(p_args[1]);
22         jcifsScan(smbRoot,sleepTime);
23     }
24         
25 }
26
Popular Tags