If you have not access to all subdirs e.g. /root/path1/path2 you have to tell cURL to use the absolute path – otherwise it will do a changeDir per subdir. Use: CURLFTPMETHOD_NOCWD or CURLFTPMETHOD_SINGLECWD see also: