Click here to Skip to main content
15,892,480 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can I upload a directory and the entire contents to a ftp server. Im using WinInet. I already have my ftp client almost finished, but I need to know how to upload the directory and its tree.

thank you for your help.



extra notes: im programming visual c++ MFC
Posted

 
Share this answer
 
well...

I guess the best way is to get your client to do a

mkdir <dir-name>
cd <dir-name>

to make the directory and change into it on the remote end, then a <put file> for all the files in the local dir, which you could use the 'findfirst'/'findnext' type scan to find. Its fairly easy to do. The added complexity, is if the dir you are uploading has subdirectories, which means you must then do it recursively it you wish for them to be uploaded as well

There's no magic bullet - any client/tool that provides an 'upload entire directory' type function is going to be doing more or less the same under the covers, possibly with a bool option to recurse or not

Unless you zip/gzip the local directory, upload that, then have some way of unzipping it on the remote side, but most ftp servers these days dont allow 'quote site' type commands which would be the ideal way of doing an unzip

'g'
 
Share this answer
 
v3

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