Directorio y descarga mediante SFTP

HMG en Español

Moderator: Rathinagiri

User avatar
serge_girard
Posts: 2224
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 501 times
Been thanked: 110 times
Contact:

Re: Directorio y descarga mediante SFTP

Post by serge_girard » Fri Nov 23, 2018 10:14 am

C:\Documents and Settings is often a problem!

I would never use it for my docs or other files. Some time ago a friend of my 'lost' his user and finally also lost the C:\Documents and Settings that belong to it.

Serge

User avatar
andyglezl
Posts: 1101
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Has thanked: 28 times
Been thanked: 64 times
Contact:

Post by andyglezl » Fri Nov 23, 2018 2:26 pm

Hace mucho tiempo, yo tuve un problema similar y desde entonces hice lo siguiente:
*----------------------------------------------------------------------------------------------------------
A long time ago, I had a similar problem and since then I did the following:


https://ccm.net/faq/30784-windows-7-mov ... tion-drive
Andrés González López
Desde Guadalajara, Jalisco. México.

edk
Posts: 421
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 125 times
Been thanked: 331 times

Post by edk » Fri Nov 23, 2018 2:27 pm

vientopamperosur wrote:
Thu Nov 22, 2018 11:39 pm
Buenas tardes. Estoy probando este exelente ejemplo y la verdad es que lo encuentro extremadamente útil y claro. Solo me encuentro con un error que no puedo identificar cuando intento leer carpetas con dos espacios, como por ejemplo Archivos de Programa, Document and Setting, etc. Adjunto la captura de pantalla del mensaje. Gracias...
To prevent error occurs on links (but their content may still not be displayed), please replace this functions:

Code: Select all

***********************************
FUNCTION RefreshRemoteGrid ( aRemoteDir, xPos )
Local aItem, i:=1

sftp.RemoteGrid.DisableUpdate()

sftp.RemoteGrid.DeleteAllItems

FOR EACH aItem IN aRemoteDir
	sftp.RemoteGrid.AddItem(aItem)
	i := sftp.RemoteGrid.ItemCount
	IF 'D' $ Upper ( sftp.RemoteGrid.CellEx( i, 5) )
		sftp.RemoteGrid.ImageIndex (i, 1) := 1		//folders icon
	ENDIF
NEXT
DO CASE
	CASE hb_IsNumeric( xPos )
		xPos := MIN( xPos, i )
	CASE hb_IsChar (xPos )
		xPos := MAX (1, ASCAN ( aRemoteDir, { |x| x [ 1 ] == xPos } ) )
	OTHER
		xPos := 1
ENDCASE
 
sftp.RemoteGrid.Value := xPos

sftp.RemoteGrid.EnableUpdate()

sftp.LabelRemote.Value := "/" + cRemoteDir
RETURN Nil
***********************************
FUNCTION RefreshLocalGrid ( aLocalDir, xPos )
Local aItem, i:=1
sftp.LocalGrid.DisableUpdate()

sftp.LocalGrid.DeleteAllItems

FOR EACH aItem IN aLocalDir
	sftp.LocalGrid.AddItem(aItem)
	i := sftp.LocalGrid.ItemCount
	IF 'D' $ Upper ( sftp.LocalGrid.CellEx( i, 5) )
		sftp.LocalGrid.ImageIndex (i, 1) := 1		//folders icon
	ENDIF
NEXT 

DO CASE
	CASE hb_IsNumeric( xPos )
		xPos := MIN( xPos, i )
	CASE hb_IsChar (xPos )
		xPos := MAX (1, ASCAN ( aLocalDir, { |x| x [ 1 ] == xPos } ) )
	OTHER
		xPos := 1
ENDCASE
sftp.LocalGrid.Value := xPos

sftp.LocalGrid.EnableUpdate()

sftp.LabelLocal.Value := cLocalDir
RETURN Nil

*******************************************************************************
FUNCTION LocalDir (aDir)
Local a1List, aDirectory:={}, a1Dir

FOR EACH a1List IN aDir
	IF 'D' $ Upper(a1List[5]) .AND. a1List[1] =="."		// Skip "." folder
		LOOP
	ENDIF
	a1Dir := ARRAY(5)
	DO CASE
		CASE 'L' $ Upper (a1List[5])						//link name
			a1Dir[1] := "[ " + a1List[1] + " ]"
			a1Dir[2] := "<LNK>"
		CASE 'D' $ Upper (a1List[5])						//dir name
			a1Dir[1] := "[ " + a1List[1] + " ]"
			a1Dir[2] := "<DIR>"
		OTHER
			a1Dir[1] := a1List[1]
			a1Dir[2] := Alltrim(Str(a1List[2]))
	ENDCASE
	a1Dir[3] := a1List[3]
	a1Dir[4] := a1List[4]
	a1Dir[5] := a1List[5] 
	AADD(aDirectory, a1Dir)
NEXT 

IF EMPTY( aDirectory ) 								//no parrent directory
	AADD(aDirectory, {"[ .. ]", "<DIR>", "", "", "d" })	//add parent directory
ENDIF


//soft list
aDirectory:=ASORT ( aDirectory, , , { |x, y| IF('D' $ Upper(x[5]), '0', '1') + Lower(x[1]) < IF('D' $ Upper(y[5]), '0', '1') + Lower(y[1])  } ) 

RETURN aDirectory

edk
Posts: 421
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 125 times
Been thanked: 331 times

Post by edk » Fri Nov 23, 2018 10:01 pm

edk wrote:
Fri Nov 23, 2018 10:08 am
An interesting fact is that after changing the working folder by DirChange ("C:\Documents and Settings"), the hb_CWD () function returns the folder's link name, not the real path name.
Similarly, the system command line behaves.
Bez tytułu.png
Bez tytułu.png (9.63 KiB) Viewed 493 times
Also does not list content, although the description about symbolic links and reparse points, says that the operating system should automatically find the target object and work on the content found.
As can be seen from the above screenshot, that in this case it is not.

User avatar
vientopamperosur
Posts: 39
Joined: Thu Aug 28, 2014 10:13 am
DBs Used: DBF, SQLite, MySQL, MariaDB, PostgreSQL
Location: Buenos Aires
Has thanked: 1 time
Contact:

Post by vientopamperosur » Sat Nov 24, 2018 10:49 am

Muchas gracias por compartir, ya tengo unos años en esto y lo que aprendo cada día con Ustedes es increíble, ya casi se ha convertido una adicción para mi. Gracias a todos...

ASESORMIX
Posts: 87
Joined: Thu Oct 25, 2012 8:08 pm
Location: Bqto, Venezuela
Been thanked: 6 times

Post by ASESORMIX » Mon Nov 26, 2018 12:35 pm

+1

Georg_BA
Posts: 36
Joined: Fri Apr 07, 2017 5:31 pm
DBs Used: DBF
Been thanked: 1 time

Post by Georg_BA » Wed Dec 26, 2018 5:03 pm

Hello, I needed to help

build.bat sftp.prg hbcurl.hbc -o"SFTP Navigator"

works without problems

I'm using when compiling HMG-IDE
i do not know how to include hbcurl.hbc
between linking commands

if it is not there (hbcurl.hbc)

an error message will appear


hbmk2: Compiling Harbour sources...
Harbour 3.2.0dev (r1703241902)
Copyright (c) 1999-2016, http://harbour-project.org/
hbmk2: Compiling...
hbmk2: Linking... sftp.exe
.hbmk/win/mingw/sftp.o:sftp.c:(.data+0x3d8): undefined reference to `HB_FUN_CURL_EASY_INIT'
.hbmk/win/mingw/sftp.o:sftp.c:(.data+0x3f8): undefined reference to `HB_FUN_CURL_EASY_RESET'
.hbmk/win/mingw/sftp.o:sftp.c:(.data+0x418): undefined reference to `HB_FUN_CURL_EASY_PERFORM'
.hbmk/win/mingw/sftp.o:sftp.c:(.data+0x438): undefined reference to `HB_FUN_CURL_EASY_STRERROR'
.hbmk/win/mingw/sftp.o:sftp.c:(.data+0x488): undefined reference to `HB_FUN_CURL_GLOBAL_CLEANUP'
.hbmk/win/mingw/sftp.o:sftp.c:(.data+0x498): undefined reference to `HB_FUN_CURL_EASY_ESCAPE'
.hbmk/win/mingw/sftp.o:sftp.c:(.data+0x4a8): undefined reference to `HB_FUN_CURL_EASY_SETOPT'
collect2.exe: error: ld returned 1 exit status

Thanks for help

Georg_BA
Posts: 36
Joined: Fri Apr 07, 2017 5:31 pm
DBs Used: DBF
Been thanked: 1 time

Post by Georg_BA » Thu Jan 31, 2019 4:29 pm

Hello everyone
I needed to connect to SFTP using Host Private Key file.

there is an option in the SFTP navigator, but I can not connect with it
did anyone try it out of you?

Thanks for help

User avatar
serge_girard
Posts: 2224
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 501 times
Been thanked: 110 times
Contact:

Post by serge_girard » Thu Jan 31, 2019 4:43 pm

Georg,

Put hbcurl.hbc into your .hbp file.

Serge

Georg_BA
Posts: 36
Joined: Fri Apr 07, 2017 5:31 pm
DBs Used: DBF
Been thanked: 1 time

Post by Georg_BA » Thu Jan 31, 2019 8:22 pm

Thx Serge

I have no problem with compilation but with connection using Host Private Key file.

Post Reply