Copying set of files to local folder to ftp

December 2, 2011 at 00:26:11
Specs: Windows XP
Hi,

i want to copy a set of local files to ftp://124.30.124.230(it will ask username and password). I want to do this work in 400 systems.. I have planned to do this work by creating a batch files and while running this batch file, this has to do that work. Anyone help me with the coding please


See More: Copying set of files to local folder to ftp

Report •


#1
December 2, 2011 at 03:28:42
Here your script, customize the parameters as explained and run.
Warning: script derived from a working one but not tested.

:: FTPCOPY.BAT Usage: ftpcopy
@echo off & setlocal

:: ------------ PARAMETERS TO BE SET BY USER -
  set _SOURCE=Here your source folder without double quotes
  set _HOSTPC=Here your FTP Host Server Name or IP Address
  set _USERID=Here your FTP session User Name
  set _PASSWD=Here your FTP session Password
:: -------------------------------------------
cls
echo.
echo.Files will be copied by %~n0 v.0.10 - Automatic FTP
echo.
echo.  from "%_SOURCE%"
echo.  to   "%_HOSTPC%"
echo.
echo.Uploading in progress, please wait...

cd "%_SOURCE%"
(
  echo.%_USERID%
  echo.%_PASSWD%
  echo.binary
  echo.mput *
  echo.quit
) > \ftp_cmd.txt
FTP -v -i -s:\ftp_cmd.txt %_HOSTPC% 2> nul 1> \ftp_log.txt

echo.DONE (Log available in \ftp_log.txt)


Report •

#2
December 5, 2011 at 00:57:36
Hi Thanks for your reply...
I have tested your code. But it is not doing anything...
I used the below codes...


@echo off & setlocal

:: ------------ PARAMETERS TO BE SET BY USER -
set _SOURCE=C:\Documents and Settings\voyager\Desktop\Ramkrishna\Daily Report
set _HOSTPC=ftp://172.16.3.130/
set _USERID=ablftp
set _PASSWD=(Password entered here)
:: -------------------------------------------
echo.
echo.Files will be copied by %~n0 v.0.10 - Automatic FTP copy
echo.
echo. from "C:\Documents and Settings\voyager\Desktop\Ramkrishna\Daily Report"
echo. to "ftp://172.16.3.130/mindscape/Ramkrishnan"
echo.
echo.Uploading in progress, please wait...

cd "C:\Documents and Settings\voyager\Desktop\Ramkrishna\Daily Report"
(
echo.%ablftp%
echo.%(Password entered)%
echo.binary
echo.mput *
echo.quit
) > \ftp_cmd.txt
ECHO. FTP -v -i -s:\ftp_cmd.txt %_HOSTPC% 2> nul 1> \ftp_log.txt

echo.DONE (Log available in \ftp_log.txt)
pause


Result:
*********

Files will be copied by ftp v.0.10 - Automatic FTP copy

from "C:\Documents and Settings\voyager\Desktop\Ramkrishna\Daily Report"
to "ftp://172.16.3.130/mindscape/Ramkrishnan"

Uploading in progress, please wait...
Access is denied.
Access is denied.
DONE (Log available in \ftp_log.txt)


Report •

#3
December 5, 2011 at 01:29:53
I edited the original post to remove the ECHO. in front of the FTP statement I missed to delete after a formal test. I supposed YOU can recognize this basic way to test and remoce it by yourself . Anyway replace

ECHO. FTP -v -i -s:\ftp_cmd.txt %_HOSTPC% 2> nul 1> \ftp_log.txt

with

FTP -v -i -s:\ftp_cmd.txt %_HOSTPC% 2> nul 1> \ftp_log.txt


Report •

Related Solutions

#4
December 5, 2011 at 02:12:15
Sorry, but I supposed you have a basic knowledge of batch scripting that seems to be not true... You need to set the UserName and Password variables at the top of the script and then NOT

echo.%ablftp%
echo.%(Password entered)%

BUT

echo.%_USERID%
echo.%_PASSWD%

MORE you have to set the Username and Password INSIDE the script otharwise FTP fails its automatic login.

This is not a newbie script, it requires a bit of experience.


Report •


Ask Question