Skip to content

Instantly share code, notes, and snippets.

@Phuseos
Created July 26, 2017 10:05
Show Gist options
  • Save Phuseos/a5fbb72b877a026baa237badb3ff57c2 to your computer and use it in GitHub Desktop.
Save Phuseos/a5fbb72b877a026baa237badb3ff57c2 to your computer and use it in GitHub Desktop.
Auto download all files from single FTP directory
REM Auto download all files from a single FTP directory
REM Made with help from https://gist.github.com/lyze237
@echo off
REM Make sure we have a dedicated folder to write to
if not exist "C:\Users\User\Desktop\FTP" mkdir "C:\Users\User\Desktop\FTP"
REM CD to the folder
cd C:\Users\User\Desktop\FTP
REM Make sure the file that holds the commands doesn't exist yet
if exist "C:\Users\User\Desktop\FTP\temp.txt" del "C:\Users\User\Desktop\FTP\temp.txt"
REM Generate a script file for the FTP server, start with login (username, password)
echo User>>temp.txt
echo Password>>temp.txt
REM Move local directory to predefined folder
echo lcd C:\Users\User\Desktop\FTP\Download>>temp.txt
REM Change to your dir, get all files from there. Set the prompt.
echo cd YourDir>>temp.txt
echo prompt>>temp.txt
echo mget *>>temp.txt
REM Close the connection to the FTP server
echo bye>>temp.txt
REM Launch the FTP command and pass the script to it, set your ftp address here.
ftp -s:temp.txt 127.0.0.1
REM Clean up, remove the command file.
del temp.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment