Rename files in directory ftp

Rename files in directory ftp

Postby vilian » Fri Aug 25, 2006 7: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
User avatar
vilian
 
Posts: 975
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Postby Antonio Linares » Sat Aug 26, 2006 6: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42077
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby vilian » Sat Aug 26, 2006 1:46 pm

Thanks antonio.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 975
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Postby vilian » 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
User avatar
vilian
 
Posts: 975
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42077
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby vilian » 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
User avatar
vilian
 
Posts: 975
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Postby Antonio Linares » Mon Aug 28, 2006 2:23 pm

Vilian,

Does the FTP user have permit to rename files ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42077
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby vilian » Mon Aug 28, 2006 5: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
User avatar
vilian
 
Posts: 975
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Postby vilian » 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
User avatar
vilian
 
Posts: 975
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Postby Antonio Linares » Tue Aug 29, 2006 7:53 am

Vilian,

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

And this to Class TFtp:
Code: Select all  Expand view
   METHOD SetCurrentDirectory( cDirName ) INLINE ;
            FtpSetCurrentDirectory( ::hFTP, cDirName )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42077
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby vilian » Tue Aug 29, 2006 11:11 am

Antonio,

Thanks for the evolution.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 975
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 81 guests