Jump to content
Sign in to follow this  
Sparrowlord

Directory

Recommended Posts

Sparrowlord

Hey I'm trying to upload the entire contents of this folder to my FTP , but I dont know how..

$pepsidir = @DesktopCommonDir & "\Pepsi\"

Maybe some how if you could array all the contents of the folder to something then when I upload Ill use something like:

$Ftpp = _FtpPutFile ($Conn, $Array, $folder)

$Array being all the files in the " Pepsi " folder on the desktop.

I've been working on this for hours and cant get anything to work, so I need help bad!

Share this post


Link to post
Share on other sites
poisonkiller

Look in help file for FileFindFirstFile and FileFindNextFile. Then you can use For...Next loop and upload every file.

Share this post


Link to post
Share on other sites
Zedna

;===================================================================================================

;
; Function Name:    _FTPPutFolderContents()
; Description:      Puts an folder on an FTP server. Recursivley if selected
; Parameter(s):     $l_InternetSession    - The Long from _FTPConnect()
;                   $s_LocalFolder     - The local folder i.e. "c:\temp".
;                   $s_RemoteFolder - The remote folder i.e. '/website/home'.
;                   $b_RecursivePut - Recurse through sub-dirs. 0=Non recursive, 1=Recursive
; Requirement(s):   DllCall, wininet.dll
; Author(s):        Stumpii
;
;===================================================================================================

Func _FTPPutFolderContents($l_InternetSession, $s_LocalFolder, $s_RemoteFolder, $b_RecursivePut)
    
; Shows the filenames of all files in the current directory.
    $search = FileFindFirstFile($s_LocalFolder & "\*.*")
    
; Check if the search was successful
    If $search = -1 Then
        MsgBox(0, "Error", "No files/directories matched the search pattern")
        Exit
    EndIf
    
    While 1
        $file = FileFindNextFile($search)
        If @error Then ExitLoop
        If StringInStr(FileGetAttrib($s_LocalFolder & "\" & $file), "D") Then
            _FTPMakeDir($l_InternetSession, $s_RemoteFolder & "/" & $file)
            If $b_RecursivePut Then
                _FTPPutFolderContents($l_InternetSession, $s_LocalFolder & "\" & $file, $s_RemoteFolder & "/" & $file, $b_RecursivePut)
            EndIf
        Else
            _FTPPutFile($l_InternetSession, $s_LocalFolder & "\" & $file, $s_RemoteFolder & "/" & $file, 0, 0)
        EndIf
WEnd

; Close the search handle
FileClose($search)

EndFunc ;==>_FTPPutFolderContents

Share this post


Link to post
Share on other sites
Sparrowlord

Or better yet instead of uploading the whole directory theres only a few files I want in there.. heres an example:

" nfs:value[*].txt " The * means there could be 0 and up there, is there anyway to only get them files to an array?

Share this post


Link to post
Share on other sites
Zedna

Or better yet instead of uploading the whole directory theres only a few files I want in there.. heres an example:

" nfs:value[*].txt " The * means there could be 0 and up there, is there anyway to only get them files to an array?

Look into Autoit helpfile at _FileListToArray()

That's exactly what you need.

Edited by Zedna

Share this post


Link to post
Share on other sites
Sparrowlord

Look into Autoit helpfile at _FileListToArray()

That's exactly what you need.

I attempted to do that but there is more than those files that I want

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  

×