Jump to content

Ftp With File Transfer Rate


Recommended Posts

Hi evry1

i try to make a ftp script that will put and get some file from our ftp server

here i have the example of ftpget with ftpfilefindfirst and ftpfilefindnextfile (awesome functions).

it works like a charm, but i just want to know it it's possible to get the transfer rate.

I've found a function that does it with inetget, so i want to add it to ftp

here is my code (still doesn't work for transfer rate)

if you have any ideas, plz tell me

autoit powa

arcker

#include <ftp.au3>
dim $dl_file

$server = 'ftp.symantec.com'
$username = 'anonymous'
$pass = 'anonymous@test.de'

$Open = _FTPOpen('MyFTP Control')
If @error Then Failed("Open")
$Conn = _FTPConnect($Open, $server, $username, $pass)
If @error Then Failed("Connect")

Dim $Handle
Dim $DllRect

$FileInfo = _FtpFileFindFirst($Conn, '/public/english_us_canada/antivirus_definitions/norton_antivirus/*i32.exe*', $Handle, $DllRect)
If $FileInfo[0] Then
   Do
;~      MsgBox(0, "Find", $FileInfo[1] & @CR & $FileInfo[2] & @CR & $FileInfo[3] & @CR & $FileInfo[4] & @CR & $FileInfo[5] & @CR & $FileInfo[6] & @CR & $FileInfo[7] & @CR & $FileInfo[8] & @CR & $FileInfo[9] & @CR & $FileInfo[10])
       $dl_file = $FileInfo[10]
       $FileInfo = _FtpFileFindNext($Handle, $DllRect)
       
   Until Not $FileInfo[0]
   
    
EndIf


_FtpFileFindClose($Handle, $DllRect)
MsgBox(0,"FTP File", "téléchargé : " & $dl_file)
ProgressOn('Downloading', '')

$tmp = $username & ":" & $pass & "@" & $server & "/public/english_us_canada/antivirus_definitions/norton_antivirus/" & $dl_file
MsgBox(0,"ok",$tmp)
Local $netDnFileSize = InetGetSize($tmp)
MsgBox(0,"ok",$netDnFileSize)
$Ftpg = _FTPGetFile($Conn, "/public/english_us_canada/antivirus_definitions/norton_antivirus/" & $dl_file,"c:\" & $dl_file)
While @InetGetActive
    ProgressSet((@InetGetBytesRead / $netDnFileSize) * 100, '', 'Update' & "  " & Round((@InetGetBytesRead / $netDnFileSize) * 100) & '% Done')
    Sleep(250)
Wend
ProgressOff()





$Ftpc = _FTPClose($Open)
If @error Then Failed("Close")

Exit

Func Failed($F)
   MsgBox(0, "FTP", "Failed on: " & $F)
   Exit 1
EndFunc

-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]
Link to comment
Share on other sites

any ideas ?

maybe you know some command line tools that can i can retrieve the output from (ouh my english is so badddddddd)

i search for a command line tool that supports ssl transfers too (no success in searching in google

BUT

my main goal is to have the transfer rate

-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]
Link to comment
Share on other sites

  • Moderators

That sucked trying to find that function... for those that are wanting to help here: http://www.autoitscript.com/forum/index.ph...ndpost&p=108495

I'll pitter around with it, I've done 0 work with FTP... but hey what the hell.

My first thought... @InetGetActive is not going to work there... Looks more like: FileGetSize() to me.. but like I said... I've done 0 work on this before.

Edit...

Ha... That even looks wrong (FileGetSize())

Edit2...

I keep getting _FTPGetFileSize() returning - 1 for an error... I would imagine that's where you would need to start.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

didn't try with this function

i use the result of the _ftpfilefindfirst to retrieve this information

but, what do you want to do with this ?

here are my too files

ftp.au3 updated with _ftpfilefindfirst and nextfile with others functions found on the server

and the example

as you can see in the exemple, the filesize is contained in $Fileinfo[9]

edit :

ups sry, it is contained in $fileinfo[5] and $fileinfo[6], and with a special function you can have the size

essaiftpfind.au3

FTP.au3

Edited by arcker

-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...