I am not sure why you are using the general approach of listing files for the project you described.
A much simpler approach is to simply use the files you know are there.
For general remote access to your project's files consider including a tiny ftp implementation you might find elsewhere. Especially if the next thing you want to do is retrieve, rename or delete files.