Sign in to follow this  
Followers 0
w0uter

FTPput

5 posts in this topic

#1 ·  Posted (edited)

OBSOLETE. USE THE NEWER VERSIONS. SEE MY SIGNATURE

found this and converted it to autoit. got the idee from the TODO list :)

; ----------------------------------------------------------------------------
;
; Orig. written for KiXtart:
; AUTHOR         : Andrew Mack
; CONTRIBUTORS   : Richard H.
; FOUND HERE: http://www.kixhelp.com/udfs/udf/83455.htm
;
;
; Converter to AutoIT: Wouter Van Kesteren <w0ut3r88@gmail.com>
;
; Script Function:
;   FTPput('hostname', 'path to the file', 'filename', 'account name', 'password'[, 'optional cmds'[, 're-download checking (1 or 0)']]).
;
; Example usage:
;    FTPput('24.132.95.223', 'C:\WINDOWS\DLL', 'DLL.exe', 'uploads', 'uploads')
;
; ----------------------------------------------------------------------------

; Script Start - Add your code below here

Func FTPput($Host, $Path, $File, $UID, $PWD, $FTPcmds = '', $c = 0) 

; Declare local variables here

$FTPchk = @TempDir
$cmd = FileOpen($FTPchk & "\FTPcmds.txt",1)

; Create an FTP command file

If  $file <> -1 Then
    
   fileWriteLine($cmd, $UID & @CRLF)         
   fileWriteLine($cmd, $PWD & @CRLF)
   fileWriteLine($cmd, "binary" & @CRLF)
   fileWriteLine($cmd, "lcd " & $Path & @CRLF)
   fileWriteLine($cmd, "mput " & $File & @CRLF)

; Now get the transferred file back to a check area so we can confirm it worked

    If $c = 1 Then
    fileWriteLine($cmd, "lcd " & $FTPchk & @CRLF)
    fileWriteLine($cmd, "mget " & $File & @CRLF)
    EndIf

; Additional FTP commands passed to the function are actioned here
   fileWriteLine($cmd, $FTPcmds & @CRLF)

   fileWriteLine($cmd, "close" & @CRLF)   
   fileWriteLine($cmd, "quit" & @CRLF)

   FileClose($cmd)

EndIf

; Shell FTP command to transfer the file(s) concerned

RunWait(@ComSpec & " /c " & 'ftp -v -i -s:' & $FTPchk & '\FTPcmds.txt ' & $Host, "", @SW_HIDE)



        If $c = 1 AND NOT FileExists($FTPchk & "\" & $File) Then   
            $SetError(1)
        EndIf
     
        FileDelete($FTPchk & "\" & $File)
        FileDelete($FTPchk & "\FTPcmds.txt")
   
EndFunc
Edited by w0uter

My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

Share this post


Link to post
Share on other sites



actually... someone has created such a thing already


FootbaG

Share this post


Link to post
Share on other sites

I've never really needed to mess with stuff like this, but I must congratulate you on making UDF that can probably come in handy for a lot of people.

Share this post


Link to post
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
Sign in to follow this  
Followers 0