hierynomus / smbj

Server Message Block (SMB2, SMB3) implementation in Java
Other
713 stars 180 forks source link

How to add brackets in (DiskShare) session.connectShare? #548

Open faizananwerali opened 4 years ago

faizananwerali commented 4 years ago

Unfortunately my smb server has folders with round brackets in folder name. how do I add these brackets om (DiskShare) session.connectShare?

public static void main(String[] args) throws Exception {
    // TODO Auto-generated method stub
    @SuppressWarnings("resource")
    SMBClient client = new SMBClient();

    try (Connection connection = client.connect("10.100.0.5")) {
        AuthenticationContext ac = new AuthenticationContext("", "".toCharArray(), "WORKGROUP");
        Session session = connection.authenticate(ac);

        // Connect to Share
        try (DiskShare share = (DiskShare) session.connectShare("English (2018)")) {
            //System.out.println(share.list(""));
            /*for (FileIdBothDirectoryInformation f : share.list("FOLDER", "*.TXT")) {*/
            for (FileIdBothDirectoryInformation f : share.list("")) {
                System.out.println("File : " + f.getFileName());
            }           
        }
    }
}
ecki commented 4 years ago

That Code looks correct. What's the error you are getting? (Note that a Share is not a folder, are you sure this is the share name?)