Page 3 of 3

Re: Directorio y descarga mediante SFTP

Posted: Fri Nov 23, 2018 10:14 am
by serge_girard
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

Re: Directorio y descarga mediante SFTP

Posted: Fri Nov 23, 2018 2:26 pm
by andyglezl
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

Re: Directorio y descarga mediante SFTP

Posted: Fri Nov 23, 2018 2:27 pm
by edk
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

Re: Directorio y descarga mediante SFTP

Posted: Fri Nov 23, 2018 10:01 pm
by edk
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 3520 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.

Re: Directorio y descarga mediante SFTP

Posted: Sat Nov 24, 2018 10:49 am
by vientopamperosur
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...

Re: Directorio y descarga mediante SFTP

Posted: Mon Nov 26, 2018 12:35 pm
by ASESORMIX
+1

Re: Directorio y descarga mediante SFTP

Posted: Wed Dec 26, 2018 5:03 pm
by Georg_BA
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

Re: Directorio y descarga mediante SFTP

Posted: Thu Jan 31, 2019 4:29 pm
by Georg_BA
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

Re: Directorio y descarga mediante SFTP

Posted: Thu Jan 31, 2019 4:43 pm
by serge_girard
Georg,

Put hbcurl.hbc into your .hbp file.

Serge

Re: Directorio y descarga mediante SFTP

Posted: Thu Jan 31, 2019 8:22 pm
by Georg_BA
Thx Serge

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