Jump to content

Recommended Posts

Posted (edited)

Hi,
i've got a small problem what i cant fix, please help me in it! :S
my problem is that my script working well if i try to check directories in root on ftp server, for example: 0:/exampledir

i explaining my problem in this script below, i cant find "exampledir" in "main dir" in root, 0:/main/, i dont know how to check dir exist inside other one, please help me!

 

Local $vServer = 'xxx'
Local $vUsername = 'xxx'
Local $vPass = 'xxx'
Local $vFTPFolder = 'exampledir'




Local $vOpen = _FTP_Open('MyFTP')
Local $vConn = _FTP_Connect($vOpen, $vServer, $vUsername, $vPass)
Local $vDirList = _FTP_ListToArray($vConn, 1)

$vSearchArray = _ArraySearch($vDirList, $vFTPFolder) ; <---this part check the directory is exist or not exist in root folder: www.mysite.com/exampledir/
;$vSearchArray = _ArraySearch($vDirList,"main/" &  $vFTPFolder) <--- i would something like this: www.mysite.com/main/exampledir/
If @error Then
    $vDirCreate = _FTP_DirCreate($vConn, $vFTPFolder )
    msgbox(0, "FTP", "Directory " & $vFTPFolder & " Created On The Server")
Else
    msgbox(0, "FTP", "Directory Already Exists On The Server")
 EndIf
Edited by retaly
Posted
_FTP_DirSetCurrent to "main dir", then _FTP_ListToArray ?

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Posted

im new in thats ftp, and in autiot aswel, i started some scripts 1 yeahrs ago then stoped it cuz i had not free time for it, now wanna to learn this more!

please help me with a short example

Posted

do you really not understand how to put _FTP_DirSetCurrent directly above your _FTP_ListToArray?   Because if writing a single line of code is your issue, you need to start a new thread.

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Posted

I dont know if you think tedium will lead to code, but it doesnt.  Code leads to code.  You HAVE to try, how did you get 121 posts in never having typed a single line of code.

....
Local $vConn = _FTP_Connect($vOpen, $vServer, $vUsername, $vPass)
_FTP_DirSetCurrent(**SOMETHING GOES HERE***) ;take a wild guess
Local $vDirList = _FTP_ListToArray($vConn, 1)....

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Posted

Wheres your script, error code, screenshot, youtube video, or facebook link to the picture of the error you took and uploaded from your smart phone?

3 words and 2/3 of an ellipsis makes me glad it didnt work. 

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Posted

there is not error, only when try it on this way: 
if i write $Conn in _FTP_DirSetCurrent then it does nothing, the script is stop at this command, not crash, not error, only not continue to read lines

 

Local $vConn = _FTP_Connect($vOpen, $vServer, $vUsername, $vPass)
_FTP_DirSetCurrent($Conn, "/testdir/")
Local $vDirList = _FTP_ListToArray($vConn, 1)
Posted (edited)

so.... there a couple of a scripts floating around like this:

'?do=embed' frameborder='0' data-embedContent>>

that utilize dirsetcurrent, none have the trailing slash (and appears none have the leading slash).  and if your connection is $vConn your script is failing when you use $Conn in  DirSetCurrent.  And that error is probably in red letters at the bottom of your Scite window when you attempt to run this script.

Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

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