FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Rename files in directory ftp
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Rename files in directory ftp
Posted: Fri Aug 25, 2006 07:39 PM

Hi,

I use class TFTP/TFTPFILE of the FWH and I am needing to rename files in directory ftp. How I can make this?

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Rename files in directory ftp
Posted: Sat Aug 26, 2006 06:55 AM

Vilian,

Please add this function to source\winapi\wininet.prg:

DLL32 FUNCTION FtpRenameFile( hFTP AS LONG, cOldFileName AS LPSTR, cNewFileName AS LPSTR ) ;
AS BOOL PASCAL ;
FROM "FtpRenameFileA" LIB hWinINet

And add this Method to Class TFtp:

METHOD RenameFile( cOldFileName, cNewFileName ) CLASS TFTP

return If( ::hFTP != nil, FtpRenameFile( ::hFTP, cOldFileName, cNewFileName ), .f. )

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Rename files in directory ftp
Posted: Sat Aug 26, 2006 01:46 PM

Thanks antonio.

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Rename files in directory ftp
Posted: Mon Aug 28, 2006 11:57 AM

Hi Antonio,

Already I tried to use oFtp:RenameFile() informing the way, without informing, but I do not obtain to rename archives. You can help me?

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Rename files in directory ftp
Posted: Mon Aug 28, 2006 12:13 PM

Vilian,

Please do a MsgInfo( oFTP:RenameFile( ... ) ) and lets check the returned value.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Rename files in directory ftp
Posted: Mon Aug 28, 2006 12:17 PM

Antonio,

It´s returned value .F.

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Rename files in directory ftp
Posted: Mon Aug 28, 2006 02:23 PM

Vilian,

Does the FTP user have permit to rename files ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Rename files in directory ftp
Posted: Mon Aug 28, 2006 05:56 PM

Hi Antonio,

I have total access to directory ftp. I execute the command thus:

oFTP:RenameFile(;
"/ premierefilmes/web/txts/bilhetes/teste.old", "teste.txt")

Also already I tested thus:

oFTP:RenameFile(;
"/premierefilmes/web/txts/bilhetes/teste.old",;
"/premierefilmes/web/txts/bilhetes/teste.txt")

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Rename files in directory ftp
Posted: Tue Aug 29, 2006 12:20 AM

Hi Antonio,

The problem with the Rename command, is that it so changes the name of archives in the current directory, or either, that to move for the directory where is located the archive before executing the Rename command.

It will be that in the WinINet.dll we have a command equivalent to the Cd() of fivewin?

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Rename files in directory ftp
Posted: Tue Aug 29, 2006 07:53 AM
Vilian,

Add this to source\winapi\wininet.prg:
DLL32 FUNCTION FtpSetCurrentDirectory( hFTP AS LONG, cDirName AS LPSTR ) ;
                              AS BOOL PASCAL ;
                              FROM "FtpSetCurrentDirectoryA" LIB hWinINet

And this to Class TFtp:
   METHOD SetCurrentDirectory( cDirName ) INLINE ;
            FtpSetCurrentDirectory( ::hFTP, cDirName )
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Rename files in directory ftp
Posted: Tue Aug 29, 2006 11:11 AM

Antonio,

Thanks for the evolution.

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil

Continue the discussion