简体   繁体   中英

QFtp create directory only if it doesn't exist

I inherited a project at work and at a certain point I'm supposed to send (recursively) a folder and its content to a ftp server using QFtp (connected with signals and slots).

This works perfectly okay except that if I try to create a destination directory :

m_pFtp->mkdir(sRemoteFullPath);

and that directory already exist, all subsequent commands won't execute (all the put() and other mkdir() for deeper folders that already have been 'started'). I do catch the error but all other commands are discarded and not carried out (if I debug-jump the mkdir() when I know the folder exists, everything works fine).

So my question is, is there a way to :

A) Ignore this 'error' ("Creating directory failed: Directory already exixts")?

or

B) Somehow only create the directory if it doesn't exist?

I know that I can do it 'the long way', ie. scanning the whole subfolder structure on the server and act accordingly but a simpler solution would be both faster (to code) and in my opinion neater :-)

Thanks!

ps. I'm using WinXP, Qt and Filezilla server.

经过一番观察,看来“ 漫长的路途 ”实际上是每个人都推荐的方式。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM