Matrix112 Posted June 29, 2006 Share Posted June 29, 2006 I tried this, but won´t wrk too. Func _FTPOpenFile($l_FTPSession, $s_FilePath, $access, $dwflags, $l_Context = 0) If $access = 1 Then $dwAccess = 0x40000000 Else $dwAccess = 0x80000000 EndIf Local $ai_FTPOpenFile = DllCall('wininet.dll', 'none', 'FtpOpenFile', 'long', $l_FTPSession, 'str', $s_FilePath, 'int', $dwAccess, 'int', $dwFlags, 'long', $l_Context) If @error OR $ai_FTPOpenFile[0] = 0 Then SetError(-1) Return 0 EndIf Return $ai_FTPOpenFile[0] EndFunc Link to comment Share on other sites More sharing options...
w0uter Posted June 30, 2006 Author Share Posted June 30, 2006 call getlasterror in kernel32.dll My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
dnsi Posted July 3, 2006 Share Posted July 3, 2006 When i multiple upload i cant and it errors. My Programs:Flip-Flop File Encryption SysyemMULTIPLAYER-SOCKETSERVERHide An Archive In A Picture Link to comment Share on other sites More sharing options...
lsakizada Posted August 9, 2006 Share Posted August 9, 2006 (edited) This method get files from remote ftp server. I tested it and its works for me. ;=============================================================================== ; ; Function Name: _FTPGetFile() ; Description: Get file from a FTP server. ; Parameter(s): $l_FTPSession - The Long from _FTPConnect() ; $s_LocalFile - The local file. ; $s_RemoteFile - The remote Location for the file. ; $l_Flags - Special flags. ; $l_Context - I dont got a clue what this does. ; Requirement(s): DllCall, wininet.dll ; Return Value(s): On Success - 1 ; On Failure - 0 ; Author(s): Wouter van Kesteren ; ;=============================================================================== Func _FTPGetFile($l_FTPSession, $s_LocalFile, $s_RemoteFile, $l_Flags = 0, $l_Context = 0) Local $ai_FTPGetFile = DllCall('wininet.dll', 'int', 'FtpGetFile', 'long', $l_FTPSession, 'str', $s_LocalFile, 'str', $s_RemoteFile, 'long', $l_Flags, 'long', $l_Context) If @error OR $ai_FTPGetFile[0] = 0 Then SetError(-1) Return 0 EndIf Return $ai_FTPGetFile[0] EndFunc;==> _FTPGetFile() Edited August 9, 2006 by lsakizada Be Green Now or Never (BGNN)! Link to comment Share on other sites More sharing options...
maxmax20 Posted August 13, 2006 Share Posted August 13, 2006 Hello, iam new here and want to write the following script in autoit I want to create a directory on my FTP server with CHMOD 777, that any user can push files there. I found to use this code: ;=============================================================================== ; ; Function Name: _FTPMakeDir() ; Description: Makes an Directory on an FTP server. ; Parameter(s): $l_FTPSession - The Long from _FTPConnect() ; $s_Remote - The file name to be deleted. ; Requirement(s): DllCall, wininet.dll ; Return Value(s): On Success - 1 ; On Failure - 0 ; Author(s): Wouter van Kesteren ; ;=============================================================================== Func _FTPMakeDir($l_FTPSession, $s_Remote) Local $ai_FTPMakeDir = DllCall('wininet.dll', 'int', 'FtpCreateDirectory', 'long', $l_FTPSession, 'str', $s_Remote) If @error OR $ai_FTPMakeDir[0] = 0 Then SetError(-1) Return 0 EndIf Return $ai_FTPMakeDir[0] EndFunc;==> _FTPMakeDir() But this script only chnages the permissions to 745. Is there a change, and can somebody help me to get the permissions to 777. Would be great! Thanks, Markus Link to comment Share on other sites More sharing options...
Endgame Posted August 17, 2006 Share Posted August 17, 2006 I've looked through the forums and I have not seen anything about this so I hope that I'm not asking a question that already has an answer. I am a firm believer in RTFM. When I want to delete a folder from a remote FTP server, does the folder need to be empty first? Or can I just delete the folder and it will take out all of the files automatically? Endgame EndgameMy UDFsFile Size ConvertMacros in INI UDF Link to comment Share on other sites More sharing options...
Rick Posted August 17, 2006 Share Posted August 17, 2006 dunno what happens when you try it?? Who needs puzzles when we have AutoIt!! Link to comment Share on other sites More sharing options...
Ruud0209 Posted August 30, 2006 Share Posted August 30, 2006 Hey W0uter, how's the _FTP UDF coming along ? any chance of seeing an update anytime soon ? thanks for your effor sofar .. Link to comment Share on other sites More sharing options...
VeeDub Posted September 18, 2006 Share Posted September 18, 2006 Hey W0uter,how's the _FTP UDF coming along ?any chance of seeing an update anytime soon ?thanks for your effor sofar .. There's another FTP.au3 that has some different functions hereVW Link to comment Share on other sites More sharing options...
Ruud0209 Posted September 18, 2006 Share Posted September 18, 2006 There's another FTP.au3 that has some different functions hereVWThanks for the tip. I'll check it out Link to comment Share on other sites More sharing options...
Drivvle Posted September 27, 2006 Share Posted September 27, 2006 Is there a way to check the free disk space still available on an ftp site? Or, space currently being used up? I work for a company that periodically needs to poll ftp sites, get files, we process them, then put files back into their site. Occasionally, we run into the problem where their ftp site has run out of disk space. I was hoping to make a script to check for disk space still available and run it a few days before I know I'll be uploading files onto their site. That way I could give them a day or 2 heads up that they need somebody on their end to clear up some space for the incoming data. Link to comment Share on other sites More sharing options...
Unicom Posted October 5, 2006 Share Posted October 5, 2006 I am trying to use the _FTPGetFileSize function to compare the size of the file after it was ftp'ed to before it was ftp'ed. on the first pass through the while loop the file will be transmitted and I get the size just fine, on the second pass it will error out on the _FTPputfile command as if the connection was closed.Hi jerran,I am having similar problems,after getting the filesize by _FTPGetFileSize of an existing file I cant upload anymore by _FtpPutFile.As long I do "_FTPGetFileSize" - tests to non-existings files "_FtpPutFile" works fine - after the first positive occurence of "_FTPGetFileSize" it doesnt work anymore. Link to comment Share on other sites More sharing options...
Joke758 Posted October 7, 2006 Share Posted October 7, 2006 (edited) I'd be interesting for the FTPOpenFile but it doesn't work.. I tried several things but nothing works. Edited October 7, 2006 by Joke758 [u]My Programs:[/u]Word Search Creator - Make your own Word SearchShortHand - Hide a secret message in a jpg fileHex Editor - Edit your Binary fileIncrease file size - Increase the size of any filesArt Generator - A program that generate random picture[u]My Functions:[/u]16-Bits Hash - My Hash function similar to MD5Probabilities - My probabilities function (factorial, permuation, combination)_GetDate() - Convert a date to a day of the week_Base(), _Dec() - Convert a number in any base (bin, oct, hex, dec). Create your own! Link to comment Share on other sites More sharing options...
Beege Posted October 13, 2006 Share Posted October 13, 2006 (edited) You have to close and reopen the connection for each file that you want to get the size of. they talk about it here under remarks.FTPFileOpenI found that something like this works...$server = '192.168.0.3'$username = 'xbox'$pass = 'xbox'For $i = 1 to $TransferList[0] $Open = _FTPOpen('xbox') $Conn = _FTPConnect($Open, $server, $username, $pass, 1) $setdir = _FTPSetCurrentDir($Conn, '/F/Videos/') $size = _FTPGetFileSize($Conn, $TransferList[$i]) MsgBox(0, '', $size & ' ' & $TransferList[$i]) $Ftpc = _FTPClose($Open)Next Edited October 13, 2006 by bchris01 Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator Link to comment Share on other sites More sharing options...
Walkabout Posted October 18, 2006 Share Posted October 18, 2006 Hi All, I needed a procedure to recursively get the contents of a remote directly, so here it is: expandcollapse popup;=============================================================================== ; ; Function Name: _FTPGetFoldercontents ; Description: Recursively retrieves the contents of a directory on an FTP server. ; Parameter(s): $s_Server - Server name/ip. ; $s_Username - Username. ; $s_Password - Password. ; $s_RemoteDir - The directory on the server to retrieve. End in "/" ; $s_LocalDir - The Local directory to save to ; Requirement(s): DllCall, wininet.dll ; Return Value(s): On Success - None. Byref variable $i_Count returns number of files (not ; including directories) transferred. ; On Failure - None, exits with Msg. Opportunity here for some improvement ; Author(s): Walkabout 2006-10-18 ; ;=============================================================================== Func _FTPGetFolderContents($s_Server, $s_UserName, $s_Password, $s_RemoteDir, $s_LocalDir, ByRef $i_Count) Local $h_Handle Local $DllRect Local $FileInfo[12] Local $Open Local $Conn Local $s_Filename ;Open the Connection. This has to be done for each new level of recusion. $Open = _FTPOpen ('MyFTP Control') If @error Then Failed ("Open") $Conn = _FTPConnect ($Open, $s_Server, $s_UserName, $s_Password, 1) If @error Then Failed ("Connect") ;First File If Not FileExists($s_LocalDir) Then DirCreate($s_LocalDir) $FileInfo = _FtpFileFindFirst ($Conn, $s_RemoteDir & '*.*', $h_Handle, $DllRect) $error = @error If Not $FileInfo[0] Then Return $s_Filename = $FileInfo[10] ConsoleWrite($i_Count & " - " & $s_RemoteDir & $s_Filename & @LF) If $FileInfo[1] = 16 Then;Directory. Recurse down one level If $s_Filename <> "." And $s_Filename <> ".." Then If Not FileExists($s_LocalDir & $s_Filename & "\") Then DirCreate($s_LocalDir & $s_Filename & "\") _FTPGetFolderContents($s_Server, $s_UserName, $s_Password, $s_RemoteDir & $s_Filename & "/", $s_LocalDir & $s_Filename & "\", $i_Count) EndIf Else; File. Retrieve it $Result = _FTPGetFile ($Conn, $s_RemoteDir & $s_Filename, $s_LocalDir & $s_Filename) $i_Count += 1 EndIf ;Subsequent Files While 1 $FileInfo = _FtpFileFindNext ($h_Handle, $DllRect) If Not $FileInfo[0] Then Return $s_Filename = $FileInfo[10] ConsoleWrite($i_Count & " - " & $s_RemoteDir & $s_Filename & @LF) If $FileInfo[1] = 16 Then;Directory. Recurse down one level If $s_Filename <> "." And $s_Filename <> ".." Then If Not FileExists($s_LocalDir & $s_Filename & "\") Then DirCreate($s_LocalDir & $s_Filename & "\") _FTPGetFolderContents($s_Server, $s_UserName, $s_Password, $s_RemoteDir & $s_Filename & "/", $s_LocalDir & $s_Filename & "\", $i_Count) EndIf Else; File. Retrieve it $Result = _FTPGetFile ($Conn, $s_RemoteDir & $s_Filename, $s_LocalDir & $s_Filename) $i_Count += 1 EndIf WEnd EndFunc ;==>_FTPGetFolderContents and an example #include <ftp.au3> $server = 'ftp.myserver.com' $username = 'ftpuser' $pass = 'password' Local $RemoteDir = '/wwwroot/' Local $LocalDir = "C:\TempDir\" Local $Count = 0 _FTPGetFolderContents($Server, $UserName, $Pass, $RemoteDir, $LocalDir,$Count) msgbox(0,"Complete",$Count & " Records Processed") I played around with the code a little, tidying it up before posting. As I can't test that my changes haven't broken it, let me know if you spot any issues. Walkabout My Stuff:AutoIt for the MassesWait until Oracle Apps is readySend email natively from Autoit3 Link to comment Share on other sites More sharing options...
Walkabout Posted October 19, 2006 Share Posted October 19, 2006 FYI This UDF no longer seems to work with the latest beta 3.2.10. Walkabout My Stuff:AutoIt for the MassesWait until Oracle Apps is readySend email natively from Autoit3 Link to comment Share on other sites More sharing options...
plastix Posted November 11, 2006 Share Posted November 11, 2006 (edited) Doesn't seem to work here either with 3.2.1.12 [For reference, Valik explains why fuctions are failing in current AutoIt - see Valik's Post in support for info.] Edited November 12, 2006 by plastix Link to comment Share on other sites More sharing options...
Developers Jos Posted November 11, 2006 Developers Share Posted November 11, 2006 Care to explain what your problem is or you want us to guess ? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
friendfox Posted November 20, 2006 Share Posted November 20, 2006 I needed a function it can download file from a ftp server. The function "INETGET" can do it ,but when download file use "INETGET",it write the target file and write the internet TEMP file at on time too,so caused the computer slowly. (谢谢)THX. Link to comment Share on other sites More sharing options...
/dev/null Posted November 20, 2006 Share Posted November 20, 2006 I needed a function it can download file from a ftp server.The function "INETGET" can do it ,but when download file use "INETGET",it write the target file and write the internet TEMP file at on time too,so caused the computer slowly.(谢谢)THX.InetGet?? Did you read the first post of this thread???CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now