File: SmbTimeout.java

package info (click to toggle)
jcifs 1.3.16-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 2,856 kB
  • sloc: java: 23,124; xml: 3,663; ansic: 386; sh: 170; makefile: 26
file content (25 lines) | stat: -rw-r--r-- 814 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import jcifs.smb.SmbFile;

public class SmbTimeout {

    public static void jcifsScan(String root, int sleepTime) throws Exception {
        long start = System.currentTimeMillis();
        SmbFile smbRoot = new SmbFile(root);
        SmbFile[] files = smbRoot.listFiles();
        for(SmbFile f : files) {
            System.out.println( f + ": " + f.canRead()+" : "+ f.length() + ": " + (System.currentTimeMillis()-start));
        Thread.sleep(sleepTime);
        }
    }

    public static void main(String[] p_args) throws Exception {
        if(p_args.length!=2) {
            System.out.println("Usage: <smbroot> <sleeptime(ms)>");
            return;
        }
        String smbRoot = p_args[0];
        int sleepTime = Integer.parseInt(p_args[1]);
        jcifsScan(smbRoot,sleepTime);
    }
        
}