i am not using the gui, so i want to know how i can read the contents of a specified folder.
thanks in advance.
Well, if you are using the API for FTP connections, what you will need to do when logged onto the server is go to the directory you would like to read the contents of, using the chdirRaw() method. Then, you can use the list() command, where the parameter you send to it is the name of the file (including the path) that you would like the directory's contents to be saved to. You must also make sure you put the list() command in a try/catch block in case an exception is raised. Then to extract filenames, you can use the sortLs() method, where the parameter you send to it is the name and path of the file where the directory contents were saved (same parameter as in list()). File sizes and permissions are extracted with use of the sortSize() and getPermissions() respectively (where again, the parameter sent is the name and path of the file, same as the one sent to the list() command.)
If it would help, perhaps I could post some example code here. And if you have any further questions, you can go ahead and ask them here. This is the way you would display directory contents when using the API, and if there are any changes that you think should be made to the API so that it can better suit your needs, then you may go ahead and ask about that. Also, if you would like to see improved documentaion of the API, that too is something we have considered and we are open to any suggestions for improving the documentation.
I will apreciate if you put here some sample codes as you proposed.
Indeed I need to delete all files in a directory so I need to read the directory contents.
I see that you have posted another message in these forums which did receive a reply, but I can still put up some sample code if you would still like that. Unfortunately, my PC is not working (I'm using a different one for now) and so it might be difficult for me to do this in the near future. But I'll see what I can do for you and will do what I can to help if you would still like me to do this for you.
You mean there not a way to get a directory listing without creating a temporary file?
To answer my own question, yes.
list() no longer takes a parameter, instead read the vector currentListing after calling list().
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.