Hi
Im trying to comunicate with a FTP server,where i want to execute a program,but i don`t know how.
I tryed with psexec..something like this
Code:
Dim command As String
command = Shell("CMD.exe")
Dim systemName As String
systemName = "IP" 'Here im using the IP'
Shell("psexec \\" & systemName & command)
But cmd.exe is opening on my computer..is the first time when im using psexec and i don`t know how..and im not an advanced.
Use Windows Explorer, type FTP:// and the address of the FTP Server
It will prompt you for the user name/password, and you can remember it.
I have a CMD script that opens the site, I drag a file, and close it for the week.
Works fine.
No like that,i wan`t to make a program and when you run it,on that ftp server is runing another program and is register something,and i will know who runned the program,let`s say i want to do it for another pc not for ftp..
How to do it?
But psexec is only for Lan connections?
The program will be on my site and downloaded by users..and when will run it to run cmd.exe and a 'command' on another pc..
Im trying to comunicate with a FTP server,where i want to execute a program,but i don`t know how.
what y want to perform with ftp ?download some files from ftp .upload on ftp or something other ?let me know very exactly .
Use a FTP Batch Script to download the file then you can use
use this method .try the following way .i have been using in hundreds of application .we are no one retail company in Kuwait city .go through the following way .
Code:
Public Function DownloadFile() As Boolean
Dim strMsg$
Dim strLine$
Dim gstrMessage$
Dim processID#
Dim process_handle#
Dim zipapfilepath$
Dim BatchPathLoc As String
Dim DownloadFilepath$
Dim FTPCommandList As String
'------------------------ Authentication--------------------------
DownloadFilepath = "\Inditexx\Download"
Call CheckInditexFolder(DownloadFilepath)
FTPCommandList = strDwnldFilePth & "\FTPCommandList.txt"
Open FTPCommandList For Output As #1
strLine = ""
strLine = "USERNAME" & vbCrLf & _
"PASSWORD" & vbCrLf & _
"ascii" & vbCrLf & _
"prompt off" & vbCrLf & _
"cd /outgoing/articles/" & vbCrLf & _
"mget ART*.ZIP" & vbCrLf & _
"close" & vbCrLf & _
"bye" & vbCrLf
Print #1, strLine
Close #1
BatchPathLoc = strDwnldFilePth & "\FTPDownBatchFile.bat"
Open BatchPathLoc For Output As #1
strLine = ""
strLine = "C:" & vbCrLf & _
"cd " & DownloadFilepath & vbCrLf & _
"C:\WINDOWS\system32\ftp.exe -s:" & FTPCommandList & " ftp1.inditex.com" & vbCrLf
Print #1, strLine
Close #1
'----------------------- Downloading Data with FTP ------------------------------
processID = Shell(BatchPathLoc, vbHide)
process_handle = OpenProcess(SYNCHRONIZE, 0, processID)
'NOT NEEDED--->If process_handle <> 0 Then
WaitForSingleObject process_handle, INFINITE
CloseHandle process_handle
'NOT NEEDED--->End If
gstrMessage = gstrMessage & "Searching for files in <IN> folder" & vbCrLf
'gstrMessageToUser = gstrMessageToUser & "Searching for files in <IN> folder" & vbCrLf
'
' Use your own path instead of \projectFTPData or create this folder on your C drive
'
If Dir$("c:\Inditexx\Download" & "\ART*.ZIP") = "" Then
strMsg = strMsg & "No files on FTP to download" & vbCrLf
MsgBox strMsg
Exit Function
Else
DownloadFile = True
strMsg = strMsg & "Files Downloaded from FTP" & vbCrLf
MsgBox strMsg
End If
End Function
Public Sub CheckInditexFolder(path As String)
If Dir("C:\Inditexx", vbDirectory) = "" Then
MkDir "C:\Inditexx"
End If
If Dir("C:\Inditexx\download", vbDirectory) = "" Then
MkDir "C:\Inditexx\download"
End If
End Sub
Last edited by firoz.raj; May 25th, 2012 at 05:49 AM.
BE CAREFUL about your language and attitude on the forums..
The AUP (Acceptable Use Policy) is Very Clear on this
*You will not post any Content that is knowingly false, misleading, or inaccurate.
*You will not behave in an abusive and/or hateful manner, and will not harass, threaten, nor attack anyone.
*You will not use profanity
The OP did say..
Originally Posted by TzAkS
....
but i don`t know how
......
and im not an advanced.
And your code is nothing more than an Overly advanced way of doing what was proposed.
Bookmarks