Saturday 31 March 2012

Accessing windows shared disks from the linux systems

If you need to access windows shared directories on your local network from linux systems, you can use the following open source Java SMB client:

This client lets you access windows shared folders programmatically.
The following is an example client which you can use after downloading jar from the above location.

examples/AuthListFiles.java

SmbFile from = new SmbFile( "smb:// 192.168.1.4/7-Zip/7zCon.sfx" );
SmbFile to = new SmbFile( "smb://192.168.1.2/temp/7zCon.sfx" );
if(!to.exists())
     System.out.println(" Not found !!");
from.copyTo( to );

The full format for SMB url/links is as follows:
smb://domain\;user:pass@server/pub/

No comments:

Post a Comment