How to create directories using samba client

RK Poddar picture RK Poddar · Jul 2, 2014 · Viewed 8.6k times · Source

I have a java code for samba client that puts a file from my unix machine to a windows machine. I need to check if a directory exits, and if not, create the directory and then put the file in that directory. I am able to put the file in an existing directory. It is the creating a new directory part that seems tricky.

Answer

Jens picture Jens · Jul 2, 2014

if you use JCIFS lib you can create a directory using SmbFile

 SmbFile sFile = new SmbFile(path, authentication);        
 sFile.mkdir();

For more information see the documentation