Jump to content

Automatically upload files to FTP server


Ram
 Share

Recommended Posts

Hi Team,

I have 200 images files on my webserver. I would like to move 10 files to a particular folder in my webserver every Sunday automatically.

Is this possible using AutoIT? if so can you please guide me to the right directions?

FTP.au3 didn't work for me. I tried the following to test if I can atleast access the web folder.

#Include <FTP.au3>

const $Host = 'mydomain'

const $Login = 'myusername'

const $Password = 'mypassword'

local $hFtp, $hSession, $hFind, $tFind

_FTP_Startup()

$hFtp = _FTP_Open('MyFtp')

$hSession = _FTP_Connect($hFtp, $Host, $Login, $Password)

$tFind = DllStructCreate($tagWIN32_FIND_DATA)

$hFind = _FTP_FileFindFirst($hSession, '', $tFind)

while not @error

ConsoleWrite(DllStructGetData($tFind, 'FileName') & @CR)

_FTP_FileFindNext($hFind, $tFind)

wend

_FTP_FileFindClose($hFind)

_FTP_Disconnect($hSession)

_FTP_Close($hFtp)

_FTP_Shutdown()

It gave me error:

C:\Users\FTP.au3 (296) : ==> Can not redeclare a constant.:

global const $FILE_ATTRIBUTE_ARCHIVE = 0x0020

global const ^ ERROR

>Exit code: 1 Time: 0.318

Awaiting your response!

Thanks!

Link to comment
Share on other sites

Do you have the include line "#Include <FTP.au3>" repeated somewhere? Because the code you posted doesn't contain that Global variable, so it would have to be happening inside the UDF. Where did you get FTP.au3 from?

:D

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...