Click here to Skip to main content
14,735,028 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to grab entire folder from FTP , I know have to grab a single file from a folder but not the entire folder.

What I have tried:

I have tried searching online for this but can't find any solution
Posted
Updated 9-Dec-19 11:42am
v2
Comments
F-ES Sitecore 9-Dec-19 11:34am
   
The reason you can't find a solution is because FTP doesn't support folder operations. Using mget is one solution, another is to list all files and go a get individually. If you search for this frequently asked question I'm sure you'll find sample code.
Stefan_Lang 9-Dec-19 11:41am
   
If you haven't found anything useful online, then either you haven't actually tried very hard, or you have additional requirements you haven't mentioned yet.

Try this: https://www.ecosia.org/search?q=C%23+download+all+files+from+FTP+location

Quote:
I have tried searching online for this but can't find any solution
No idea what you searched for, but there are plenty of suggestions at ftp get all files - Google Search[^].
   
Comments
KGr28 9-Dec-19 11:41am
   
I'm not trying to grab the files singly b/c they change from day to day, I need to be able to grab an entire folder
Richard MacCutchan 9-Dec-19 11:47am
   
Well if ftp does not allow that there is nothing you can do. Look at the ftp documentation to see whether there is a shortcut method that will do it..
Stefan_Lang 10-Dec-19 3:06am
   
If writing a loop in C# to get all files is too much, why did you tag it as C#?
Dave Kreskowiak 9-Dec-19 12:20pm
   
You simply have no choice. The only thing you can do is get the list of files in the folder, then download every file one-by-one.
Short Answer: No.
By definition, FTP is a protocol that makes transfers at the file level.
The only other consistent features are based on navigation to the files, or selection of multiple files.

What you may want to do is talk to the owner of the FTP information you desire and see if they can create a daily ZIP for you to download.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900