Deleting All Files in an FTP Directory using VB.Net 2.0 and FTPWebRequest If I know the name of the file, I have no problems doing this. However, I would like to delete *any* file in the folder. Download, Upload,Delete Files from FTP Server Using C# Posted in ASP.NET, C# By Rashedul Alam On March 9, 2013. FTP is a file transfer protocol. We can use it in different ways. Move File from One Directory to Another in the FTP Server in C# The following C# code will move file from one directory to another in FTP server. I've been searching for a simple solution to download a folder, all subfolders, and files from a file server. I currently use DriveHQ, and their tech support hasn't been able to help. I'm using simple ftp but it apparently doesn't support downloading folders and their contents. I have a code for displaying all files inside a folder in a FTP Server, but I dont know how to view a folder inside of a FTP Server. How to download file from ftp server using vb.net 2008. How to create an ftp server using VB.NET code. C# Browse Folders in ftp.

Active2 years, 5 months ago

I'm trying to ftp a folder using the command line ftp client, but so far I've only been able to use 'get' to get individual files.

dotancohen
15.8k22 gold badges108 silver badges159 bronze badges
Charles Ma

As you may know, using Foreach loop with configuring enumerator as file enumerator will not work on remote ftp folder. A work around can be this: copy all remote files to a local directory and then find file names which are old, and then in a foreach loop delete these files with ftp task.

Charles Ma
30k18 gold badges74 silver badges95 bronze badges

closed as off-topic by Dukeling, Zaffy, tstenner, Sascha, Lee TaylorNov 17 '13 at 21:35

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • 'Questions about general computing hardware and software are off-topic for Stack Overflow unless they directly involve tools used primarily for programming. You may be able to get help on Super User.' – Dukeling, Zaffy, tstenner, Sascha, Lee Taylor
If this question can be reworded to fit the rules in the help center, please edit the question.

12 Answers

You could rely on wget which usually handles ftp get properly (at least in my own experience). For example:

You can also use -m which is suitable for mirroring. It is currently equivalent to -r -N -l inf.

If you've some special characters in the credential details, you can specify the --user and --password arguments to get it to work. Example with custom login with specific characters:

EDITAs pointed out by @asmaier, watch out that even if -r is for recursion, it has a default max level of 5:

If you don't want to miss out subdirs, better use the mirroring option, -m:

fduff
2,4731 gold badge21 silver badges31 bronze badges
Thibaut BarrèreThibaut Barrère
7,6002 gold badges15 silver badges23 bronze badges

Just to complement the answer given by Thibaut Barrère.

I used

Note the double slash after the server name. If I don't put an extra slash the path is relative to the home directory of user.

  • -nH avoids the creation of a directory named after the server name
  • -nc avoids creating a new file if it already exists on the destination (it is just skipped)
  • --cut-dirs=5 allows me to take the content of /absolute/path/to/directory and to put it in the directory where I launch wget. The number 5 is used to filter out the 5 components of the path. The double slash means an extra component.
Ludovic KutyLudovic Kuty

Download All Files Ftp Directory Vb Net Remove Record From Datatable

4,0532 gold badges19 silver badges36 bronze badges
Vinko VrsalovicVinko Vrsalovic
212k46 gold badges304 silver badges353 bronze badges

If lftp is installed on your machine, use mirror dir. And you are done. See the comment by Ciro below if you want to recursively download a directory.

DilawarDilawar
2,5457 gold badges33 silver badges50 bronze badges

If you can use scp instead of ftp, the -r option will do this for you. I would check to see whether you can use a more modern file transfer mechanism than FTP.

Greg HewgillGreg Hewgill
707k155 gold badges1038 silver badges1183 bronze badges

Use WGet instead. It supports HTTP and FTP protocols.

Good Luck!

reference: http://linux.about.com/od/commands/l/blcmdl1_wget.htm

Jason StevensonJason Stevenson
3,0723 gold badges25 silver badges43 bronze badges

There is 'ncftp' which is available for installation in linux. This works on the FTP protocol and can be used to download files and folders recursively. works on linux. Has been used and is working fine for recursive folder/file transfer.

Check this link... http://www.ncftp.com/

CypherCypher

If you can, I strongly suggest you tar and bzip (or gzip, whatever floats your boat) the directory on the remote machine—for a directory of any significant size, the bandwidth savings will probably be worth the time to zip/unzip.

Hank GayHank Gay
53.9k26 gold badges139 silver badges213 bronze badges

If you want to stick to command line FTP, you should try NcFTP. Then you can use get -R to recursively get a folder. You will also get completion.

JazzJazz
3,1375 gold badges33 silver badges51 bronze badges

wget -r ftp://url

Work perfectly for Redhat and Ubuntu

PhillipPhillip
Download All Files Ftp Directory Vb Net Remove

You should not use ftp. Like telnet it is not using secure protocols, and passwords are transmitted in clear text. This makes it very easy for third parties to capture your username and password.

To copy remote directories remotely, these options are better:

  • rsync is the best-suited tool if you can login via ssh, because it copies only the differences, and can easily restart in the middle in case the connection breaks.

  • ssh -r is the second-best option to recursively copy directory structures.

See:

  • rsync man page

  • ssh man page

TiloTilo
29k4 gold badges67 silver badges98 bronze badges

Ftp

abatishchev

Wii Ftp Directory Structure

72k70 gold badges269 silver badges404 bronze badges

Download All Files Ftp Directory Vb Net Remover

RohitRohit

Ftp Directory Command

Not the answer you're looking for? Browse other questions tagged linuxcommand-lineftp or ask your own question.