Hi,
I'm trying to create a small app that downloads files from an FTP site. My app connects ok to the FTP site, but i want to see what files are in a sub-folder. I've tried to use SetCurrentDirectory() but this doesnt seem to do anything - when i look at the results from :Directory() it always returns what is in the root. Can anyone supply me with an example of using the :directory() routine in a sub-folder?
Many thanks
Pete
Changing directory in tFtp
-
- Posts: 363
- Joined: Wed Feb 15, 2006 2:06 pm
- Location: Oxford, England
-
- Posts: 363
- Joined: Wed Feb 15, 2006 2:06 pm
- Location: Oxford, England
Re: Changing directory in tFtp
Solved using Directory() - the path you type in is case sensitive!!
Regards,
Pete
Regards,
Pete
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Changing directory in tFtp
Pete,
Thanks for the info
Thanks for the info
-
- Posts: 363
- Joined: Wed Feb 15, 2006 2:06 pm
- Location: Oxford, England
Re: Changing directory in tFtp
I think i might have found a problem with the directory function, if i do this:
aFiles = oFTP:Directory( cDirName + "*.*" )
IF !Empty(aFiles)
FOR nCount := 1 TO Len(aFiles)
IF Left(aFiles[nCount, 1], 1) <> "."
lCopy := .F.
? File( cIwsFolder + "\Upgrade\New\" + aFiles[nCount, 1]) - This always returns .F.
If i do this:
? File( cIwsFolder + "\Upgrade\New\" + Left(aFiles[nCount, 1],12)) - This always returns the correct result
if i do this:
? "-" + Alltrim(aFiles[nCount, 1]) + "-"
the second "-" does not appear
I have got around this by using the left( , 12) example above as i know the length of the filenames
This is using FW09.05
Regards,
Pete
aFiles = oFTP:Directory( cDirName + "*.*" )
IF !Empty(aFiles)
FOR nCount := 1 TO Len(aFiles)
IF Left(aFiles[nCount, 1], 1) <> "."
lCopy := .F.
? File( cIwsFolder + "\Upgrade\New\" + aFiles[nCount, 1]) - This always returns .F.
If i do this:
? File( cIwsFolder + "\Upgrade\New\" + Left(aFiles[nCount, 1],12)) - This always returns the correct result
if i do this:
? "-" + Alltrim(aFiles[nCount, 1]) + "-"
the second "-" does not appear
I have got around this by using the left( , 12) example above as i know the length of the filenames
This is using FW09.05
Regards,
Pete
Re: Changing directory in tFtp
FtpFindFirstFile/InternetFindNextFile return the filename filled by a char, i think chr(0).
I use this
for clear the filename.
I use this
Code: Select all
HB_FUNC( CLEARSTRING )
{
hb_retc(hb_parc(1));
}
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Changing directory in tFtp
Pete,
That would mean that some not valid characters are being placed into the file name. Thats why you can extract a valid portion of it, but if you try to concatenate with another string then it fails.
Could you please test FWH\samples\FtpDir.prg and check if it works fine for you ? thanks
That would mean that some not valid characters are being placed into the file name. Thats why you can extract a valid portion of it, but if you try to concatenate with another string then it fails.
Could you please test FWH\samples\FtpDir.prg and check if it works fine for you ? thanks
-
- Posts: 363
- Joined: Wed Feb 15, 2006 2:06 pm
- Location: Oxford, England
Re: Changing directory in tFtp
Antonio,
I get the "oFTP:hFTP is null" message, yet i can access the ftp site through i.e. fine
Regards,
Pete
I get the "oFTP:hFTP is null" message, yet i can access the ftp site through i.e. fine
Regards,
Pete
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Changing directory in tFtp
Pete,
We have just tested it again using Windows 7 and it works fine using FWH 9.11, with both Harbour and xHarbour. But we got a request to allow it from the Windows firewall, that had to be accepted.
Could someone else test FWH\samples\FtpDir.prg and report here how it works ? thanks
We have just tested it again using Windows 7 and it works fine using FWH 9.11, with both Harbour and xHarbour. But we got a request to allow it from the Windows firewall, that had to be accepted.
Could someone else test FWH\samples\FtpDir.prg and report here how it works ? thanks