Jump to content

FTP New Folder


Recommended Posts

So, I searched the forums for a good 40 minutes and was unable to find a way to do this. All I'm trying to do is make a new folder on my FTP with 5 random numbers as the name for the new folder. Any suggestions of where I could look to find this?

Link to comment
Share on other sites

So, I searched the forums for a good 40 minutes and was unable to find a way to do this. All I'm trying to do is make a new folder on my FTP with 5 random numbers as the name for the new folder. Any suggestions of where I could look to find this?

You could use tcp, and if it receives something like "makefolderwith5randonumbers" then it would create a file with a variable name that makes 5 random numbers :), assuming it's your personal server.

tolle indicium

Link to comment
Share on other sites

You could use tcp, and if it receives something like "makefolderwith5randonumbers" then it would create a file with a variable name that makes 5 random numbers :), assuming it's your personal server.

Let me explain this a bit more. I have a dedicated server I rent and that is what I would like to create the new folder on. I use a lot of txt files. so im trying to make something that will back them up for me on my server.

Link to comment
Share on other sites

You could use tcp, and if it receives something like "makefolderwith5randonumbers" then it would create a file with a variable name that makes 5 random numbers :) , assuming it's your personal server.

something like

$ran = Random (1,6)

 $recv = TCPRecv( $ConnectedSocket, 2048 )
if $recv = "makefolderrandom" then  
    DirCreate ("path" &"/"& $ran)
else
  GUICtrlSetData($edit,$recv)
endif

*missing variables add them

also search forums for FTP.au3, there are a lot of FTP scripts;;;

Edited by c4nm7
Link to comment
Share on other sites

something like

$ran = Random (1,6)

 $recv = TCPRecv( $ConnectedSocket, 2048 )
if $recv = "makefolderrandom" then  
    DirCreate ("path" &"/"& $ran)
else
  GUICtrlSetData($edit,$recv)
endif

*missing variables add them

also search forums for FTP.au3, there are a lot of FTP scripts;;;

I dont quite understand that. What im trying to do is make a script so when I run it, it will make a random 5 letter name folder on my ftp and upload all the txt files in the folder "txt" on my desktop. o.O didnt know it was this confusing
Link to comment
Share on other sites

I dont quite understand that. What im trying to do is make a script so when I run it, it will make a random 5 letter name folder on my ftp and upload all the txt files in the folder "txt" on my desktop. o.O didnt know it was this confusing

func _gotill5()
$blah="Txt docnamehere"
$i=0

do
$i=$i+1
filecopy($blah,"c:\"&$blah&$i&".txt",1)
until $i=5
endfunc

screwed up a bit there..can be modified to be sent over tcp conenctions.

Edited by backstabbed

tolle indicium

Link to comment
Share on other sites

Sparrowlord is not trying to make the random name, he is trying to create a directory on an FTP server.

I don't know why FTP.au3 wouldn't cover that, have you got the latest version?

I looked at the FTP.au3 and this is what I found:

;===============================================================================
;
; 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()

Dont understand that though

Link to comment
Share on other sites

I looked at the FTP.au3 and this is what I found:

;===============================================================================
;
; 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()

Dont understand that though

_FTPMakeDir($l_FTPSession, $s_Remote)

; Parameter(s): $l_FTPSession - The Long from _FTPConnect()

; $s_Remote - The file name to be deleted

tolle indicium

Link to comment
Share on other sites

_FTPMakeDir($l_FTPSession, $s_Remote)

; Parameter(s): $l_FTPSession - The Long from _FTPConnect()

; $s_Remote - The file name to be deleted

I dont understand that one bit.. to connect I use

$server = 'xxxxx.com'
    $username = 'xxxxxxx@xxxxxx.com'
    $pass = 'xxxx'

    $Open = _FTPOpen ('FTP')
    $Conn = _FTPConnect ($Open, $server, $username, $pass)

    $Ftpc = _FTPClose ($Open)

Why is that so much easier to do than what is in the FTP.au3 ?

Link to comment
Share on other sites

WTF? when i ask if FTP.au3 is in the included folder i meant if it comes along with autoit, and you RESPO

ND LIKE THIS???????????????

cause you have the most posts that means that you can insult anyone???????????????

and that's fair;;;;;;;

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...