FTP Upload directory tree in java - java

Is there any library that supports uploading directory tree in remote server ?

You can always use the org.apache.commons.net.ftp.FTPClient client and recursively upload all files in your directory.

The Apache Virtual File System (VFS) project can do this, whilst abstracting the details of dealing directly with FTP connections.

Related

Android NFS Client

I have found a good library to implement an Android NFS Client 'nfs-client-java', I'm creating an Nfs3 Client and I can access files and create new files... on the server. But the problem is that I can't mount the whole shared directory from the server. On Linux NFS Client, I can specify the mount point with
mount -t nfs -o nolock,rw,vers=3 192.168.1.10:/media/user/ /mnt/media_rw/remote
where /mnt/media_rw/remote is where the shared directory will be mounted.
My question is: How can I achieve the same result on Android App ?
In Android app development, there's no mounting at the Linux vfs layer. So you wouldn't be able to achieve exactly the same result.
There closest thing I'm aware of is the documents provider system https://developer.android.com/reference/android/provider/DocumentsProvider. From the documentation:
A document provider offers read and write access to durable files, such as files stored on a local disk, or files in a cloud storage service.
You'd implement methods such as openFile in your NFS documents provider by, for example, downloading a copy through the library you found, opening it, and forwarding a parcelable file descriptor in the return value.

Access FTP files from java without filezilla or winscp

I have made java web application for uploading file in ftp and in the same application user can directly open files in browser. It is running successfully when Filezilla or winscp is opened. After closing filezilla and winscp I can't access or upload files to ftp. Is there any possible solution, that I can access these files from web application without installing external application. I'm using Apache commons.net library for ftp connection.
There is JSch that is a library to access sftp in Java. I have used it before in a project and is relatively straight forward. Probably you will have to work on it to open files in a web application though.
http://www.jcraft.com/jsch/examples/Sftp.java.html

Download multiple files from ftp location from ajax call through servlet/java

I have files inside folders at ftp location. I want to download multiple files from web application through ajax call.
Tried one way that copy to server from ftp and converting to zip and then download but i dont want to download to server. Is there anyway i can directly download form ftp.
Thanks in advance,
if using apache FTP client on the java server you can retrieveFileStream(path) and then iterate the inputstream and write to the HttpServletResponse

How to upload and download a directory from FTP server in java?

I am working in a project in which is is require to upload and download a directory and their all the file and folder in java .and I also need to know that uploding and downloading status means how much percent the folder to which I am uploading has been uploaded or downloaded.
You may want to look at the FTPClient class of commons-net as well.
A search for "java ftp client" on google reveals edtFTPj.
Just to throw one more library at you... you could also try Apache Commons VFS. It gives you access to tons of different file systems including FTP.

Zipping a directory to a remote location in Java

I'm trying to create a zip file from a directory in Java, then place that file on a remote server (a network share). I'm currently getting an error because the Java File object cannot reference a remote location and I'm not really sure where to go from there.
Is there a way to zip a directory in Java to a remote location without using the File class?
Create the ZIP file locally and use either commons-net FTP or SFTP to move the ZIP file across to the remote location, assuming that by "remote location" you mean some FTP server, or possibly a blade on your network.
If you are using the renameTo method on java.io.File, note that this doesn't work on some operating systems (e.g. Solaris) where the locations are on different shares. You would have to do a manual copy of the file data from one location to another. This is pretty simple using standard Java I/O.

Categories