Below class Test have copyFile method to move file from d:\\temp\\server.txt" local path to shared folder path \\\\<shared_folder_path>\\<folder_name>\\
public class Test {
public static void main(String[] args) throws org.apache.commons.vfs2.FileSystemException {
moveFile("server", "d:\\temp\\server.txt");
}
public static void copyFile(String fileName, String inputFolder)
throws org.apache.commons.vfs2.FileSystemException
{
FileObject destn = VFS.getManager().resolveFile("\\\\<shared_folder_path>\\<folder_name>\\" + fileName + ".txt");
FileObject fo = VFS.getManager().resolveFile(inputFolder);
destn.copyFrom(fo, Selectors.SELECT_SELF);
destn.close();
}
}
FileObject destn = VFS.getManager().resolveFile("\\\\<shared_folder_path>\\<folder_name>\\" + fileName + ".txt");
FileObject fo = VFS.getManager().resolveFile(inputFolder);
destn.copyFrom(fo, Selectors.SELECT_SELF);
destn.close();
}
}
No comments:
Post a Comment