Jump to content
Sign in to follow this  

FTP and files with spaces in their names

Recommended Posts


Hi all -

I'm trying to create a script (using FTP.au3) that will automatically log in to an FTP, list the directories (using _FTPFilesListToArray) and then go into each directory and retrieve certain files. However, the directories I'm trying to access contain spaces, and I can't figure out how to issue the proper '_FTPSetCurrentDirectory' command with a directory that contains spaces in the names.

I've tried quotes around the directory name, replacing spaces with %20 and underscores, but to no avail. I did do a search and found one user who 'figured it out' but didn't mention how they were able to get it to work.

Is anyone familiar with this enough to point me in the right direction?

For example:

My FTP structure is something like:



main/directory number 2

main/this is another directory

I need to be able to change directories into 'directory number 2' or 'this is another directory' using _FTPSetCurrentDirectory($session, $directoryWithSpaces), but everything I've tried doesn't seem to be working.

Thanks in advance for any advice you can provide.

Share this post

Link to post
Share on other sites

*bump* for our daytime viewers.

Well, for the benefit of future searchers, I did figure this out. It wasn't the fact that I was trying to access a folder with spaces in it, but when I issued the 'FTPSetCurrentDir()' command, I wasn't including the root folder (which is where I log in to by default).

So if I log into the ftp site and default folder structure is:



/data/folder i want to access

/data/another folder

... I'm in the 'data' folder by default.. but I had to include it in the switching of directories: /data/folder

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.