File Transfer Help


  1. Posts : 36
    windows7 64 bit
       #1

    File Transfer Help


    hi,

    I have two FTP servers namely SampleFTP1(public FTP) and SampleFTP2 (private FTP)

    Both are SFTP enabled. Lets take an example, I need to copy the text file from SampleFTP1 path C:/TestData/Test.txt and wanted to transfer to SampleFTP2 path /InputFile/Test.txt. Right now i am suing filezilla to do this as manual process. Is there any where i can automate this process by using batch script. Any example will be very helpful for me to proceed. please help me on this
      My Computer


  2. Posts : 721
    Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
       #2

    Hey there,

    FTP-ing can be done in batch.

    Here's some sample script,

    Code:
    @echo off
    
    REM Paths and file names may or may not be case sensitive!
    
    set server_1_to_connect_to=11.11.11.11
    set Username=Username
    set Password=Password
    set server_1_path=/TestData
    set file_to_download=Test.txt
    
    set server_2_to_connect_to=22.22.22.22
    set Username=Username
    set Password=Password
    set server_2_path=/InputFile
    set file_to_upload=%FILE_TO_DOWNLOAD%
    ::
    set local_path=%TEMP%
    
    ::: Download %server_1_path%/%file_to_download% to %local_path%
    	(
    		echo.%USERNAME%
    		echo.%PASSWORD%
    		echo.lcd %TEMP%
    		echo.cd %SERVER_1_PATH%
    		echo.binary
    		echo.get %FILE_TO_DOWNLOAD%
    		echo.bye
    	) > "%TEMP%\_%~n0.ftp"
    	ftp -s:"%TEMP%\_%~n0.ftp" %SERVER_1_TO_CONNECT_TO%
    	del "%TEMP%\_%~n0.ftp"
    :::
    
    ::: Upload %local_path%\%file_to_upload% to %server_2_path%
    	(
    		echo.%USERNAME%
    		echo.%PASSWORD%
    		echo.lcd %TEMP%
    		echo.cd %SERVER_2_PATH%
    		echo.binary
    		echo.put %SERVER_FILE_TO_DOWNLOAD%
    		echo.bye
    	) > "%TEMP%\_%~n0.ftp"
    	ftp -s:"%TEMP%\_%~n0.ftp" %SERVER_2_TO_CONNECT_TO%
    	del "%TEMP%\_%~n0.ftp"
    :::
    
    del %LOCAL_PATH%\%SERVER_FILE_TO_DOWNLOAD%
    It may take some fiddling around with to get it to work.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 13:41.
Find Us