Jump to content

Recommended Posts

Posted

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?

Posted

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

Posted

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.

Posted (edited)

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
Posted

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
Posted (edited)

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

Posted

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

Posted

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

Posted

_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 ?

Posted

!!!!!!! i dont have FTP.au3 , and i have installed both Au3Lib and AutoIt 3.2.4.9 (just installed them again to be sure)

is it in the include folder?

Posted

!!!!!!! i dont have FTP.au3 , and i have installed both Au3Lib and AutoIt 3.2.4.9 (just installed them again to be sure)

is it in the include folder?

Yes, my FTP.au3 is in the include folder.

Posted

Yes, my FTP.au3 is in the include folder.

can u please post it here so i can include it too?

  • Moderators
Posted

can u please post it here so i can include it too?

Search and Poof!

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.

Posted

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

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
×
×
  • Create New...