Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

FTP Download Directories Recursively

  • 17-06-2011 04:23PM
    #1
    Registered Users, Registered Users 2 Posts: 1,991 ✭✭✭


    I have a BAT script that will connect and download all the files in the root directory but I need to recursively download all sub-directories and their files, there could be sub-directories in sub-directories to the a maximum of 15 I'd say.

    I know windows native FTP command doesn't support recursive download with mget but can anyone point me to a good script function that will do what I require or even help me out with the code I have already?
    @ ECHO OFF
    ECHO:
    ECHO FTP Backup Script
    ECHO =================
    ECHO:
    SET login_script="c:\...\script.ftp"
    for /f "tokens=1-3 delims=/- " %%a in ('date /t') do set XDate=%%a%%b%%c
    for /f "tokens=1-2 delims=: " %%a in ('time /t') do set XTime=%%a%%b
    CD C:\backups\
    IF EXIST %XDate%%XTime% GOTO NODIR
    MD %XDate%%XTime%
    CD %XDate%%XTime%
    FTP -v -i -s:%login_script%
    
    :NODIR
    
    PAUSE
    

    script.ftp
    open 127.0.0.1
    root
    root
    cd public_html
    binary
    mget *.*
    disconnect
    bye
    


Comments

Advertisement