- 1 year ago
create a cmd file with a loop (wget recursive download)
Certainly! You can create a batch file with a loop to perform a recursive download using wget
. Here's an example of how you can achieve this:
batch@echo off
setlocal
REM Configure the URL and destination folder
set "url=http://example.com/"
set "destination=C:\path\to\destination"
REM Run the loop to download recursively
:download
wget -r -np -P "%destination%" "%url%"
REM Pause for a few seconds before repeating the loop
timeout /t 10 /nobreak >nul
REM Jump back to the download label
goto download
In this example, the wget
command is used with the -r
flag for recursive download, -np
flag to prevent ascending to the parent directory, -P
flag to specify the destination folder, and %url%
and %destination%
are placeholders for your specific URL and destination folder.
The loop is achieved using a label :download
and the goto
command at the end of the loop. In this example, the loop will repeat every 10 seconds (specified by timeout /t 10
) before running the wget
command again.
Save the above code into a .cmd
file, customize the URL and destination folder paths, and then run the batch file to start the recursive download.