public static void renameFile(SmbFile srcFile, String nameWithoutProtocol, NtlmPasswordAuthentication auth) throws Exception { String fileName = srcFile.getCanonicalPath(); fileName = fileName.substring(4);//removing smb-protocol new File(fileName).renameTo(new File(nameWithoutProtocol)); }
String dirDest = "access/"; try { File localDirFile = new File(dirDest); SmbFile localSmbDirFile = new SmbFile(convertFileToSmbFile(localDirFile.getCanonicalPath())); File localDirFile2 = new File(convertSmbFileToFile(localSmbDirFile.getCanonicalPath())); System.out.println("Original File Format: " + localDirFile.getCanonicalPath()); System.out.println("Original File Format to SmbFile Format: " + localSmbDirFile.getCanonicalPath()); System.out.println("Converted SmbFile Format to File Format: " + localDirFile2.getCanonicalPath()); } catch (IOException e) { System.err.println("[ERR] IO Exception - " + e); }
out.println( "<a class=\"sort\" style=\"width: 180\" href=\"?fmt=detail&sort=date\">Modified</a><br clear='all'><p>" ); path = dir.getCanonicalPath();
out.println( "<a class=\"sort\" style=\"width: 180\" href=\"?fmt=detail&sort=date\">Modified</a><br clear='all'><p>" ); path = dir.getCanonicalPath();
out.println( "<a class=\"sort\" style=\"width: 180\" href=\"?fmt=detail&sort=date\">Modified</a><br clear='all'><p>" ); path = dir.getCanonicalPath();
out.println( "<a class=\"sort\" style=\"width: 180\" href=\"?fmt=detail&sort=date\">Modified</a><br clear='all'><p>" ); path = dir.getCanonicalPath();
@Test public void testCreateSmbFileObjectWithBackSlash4() throws IOException { System.setProperty("file.separator", "/"); SmbShare smbShare = new SmbShare("smb://myshare/shared/"); SmbSession smbSession = new SmbSession(smbShare); SmbFile smbFile = smbSession.createSmbFileObject("smb://myshare\\blubba\\"); assertEquals("smb://myshare/blubba/", smbFile.getCanonicalPath()); }
@Test public void testCreateSmbFileObjectWithBackSlash3() throws IOException { System.setProperty("file.separator", "\\"); SmbShare smbShare = new SmbShare("smb://myshare\\shared\\"); SmbSession smbSession = new SmbSession(smbShare); SmbFile smbFile = smbSession.createSmbFileObject("..\\another"); assertEquals("smb://myshare/another/", smbFile.getCanonicalPath()); }
@Test public void testCreateSmbFileObjectWithBackSlash1() throws IOException { System.setProperty("file.separator", "\\"); SmbShare smbShare = new SmbShare("smb://myshare/shared/"); SmbSession smbSession = new SmbSession(smbShare); SmbFile smbFile = smbSession.createSmbFileObject("smb://myshare\\blubba\\"); assertEquals("smb://myshare/blubba/", smbFile.getCanonicalPath()); }
@Test public void testCreateSmbFileObjectWithBackSlash2() throws IOException { System.setProperty("file.separator", "\\"); SmbShare smbShare = new SmbShare("smb://myshare\\shared\\"); SmbSession smbSession = new SmbSession(smbShare); SmbFile smbFile = smbSession.createSmbFileObject("smb://myshare\\blubba\\"); assertEquals("smb://myshare/blubba/", smbFile.getCanonicalPath()); }
@Test public void testCreateSmbFileObjectwithMissingTrailingSlash2() throws IOException { SmbShare smbShare = new SmbShare("smb://myshare/shared/"); SmbSession smbSession = new SmbSession(smbShare); SmbFile smbFile = smbSession.createSmbFileObject("."); assertEquals("smb://myshare/shared/", smbFile.getCanonicalPath()); }
@Test public void testCreateSmbFileObjectwithMissingTrailingSlash3() throws IOException { SmbShare smbShare = new SmbShare("smb://myshare/shared/"); SmbSession smbSession = new SmbSession(smbShare); SmbFile smbFile = smbSession.createSmbFileObject("../anotherShare"); assertEquals("smb://myshare/anotherShare/", smbFile.getCanonicalPath()); } }
@Test public void testCreateSmbFileObjectwithMissingTrailingSlash1() throws IOException { SmbShare smbShare = new SmbShare("smb://myshare/shared"); SmbSession smbSession = new SmbSession(smbShare); SmbFile smbFile = smbSession.createSmbFileObject("smb://myshare\\blubba"); assertEquals("smb://myshare/blubba/", smbFile.getCanonicalPath()); }