Get the App
SLTechnology News&Howtos  ›  Development  › 

How to download files before a specified number of minutes on a FTP server in batches

Shulou Source: shulou.com Published: 2022-06-03 08:22:27 10月04日 Update

Editor to share with you how to batch download files before the specified number of minutes on the FTP server, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

@ echo offrem specify FTP username set ftpUser=xxxrem specify FTP password set ftpPass=xxxxxxxrem specify FTP server address set ftpIP=xxx.xxx.xxx.xxrem specify where the file to be downloaded is located on the FTP server set ftpFolder=/export/home/PROD/ntcdatarem specify where to store the file downloaded from FTP set MinsAgo=60set ftpDir=%temp%/TempDir2.txtset ftpDown=%temp%/TempDown2.txtrem specify the file a few minutes before download set MinsAgo=60set ftpDir=%temp%/TempDir2.txtset ftpDown=%temp%/TempDown2.txtrem assume local day The format of the period is yyyy-mm-dd hh:nn:ssset FileY=%date:~0,4%if% time:~0,2% lss 10 (set hh=0%time:~1,1%) else (set hh=%time:~0,2%) call: DateToMins% date:~0,4%% date:~5,2%% hh%% time:~3,2% Mins set / a Mins-=MinsAgocall: MinsToDate% Mins% DstYear DstMonth DstDay DstHour DstMin > "% ftpDir%" echo.%ftpUser% > > "% ftpDir%" echo.%ftpPass% > > "% FtpDir% "echo bin > >"% ftpDir% "echo cd"% ftpFolder% "> >"% ftpDir% "echo dir *"% temp%/FileList2.txt "> >"% ftpDir% "echo byestart ftp-v-I-s:"% ftpDir% "% ftpIP%rem adjust the delay time ping-n 350 127.1 > nulfindstr / I": * / .SWM $"% temp%/FileList2.txt" > "% temp%/FileDate2.txt" findstr / I ": * / .TWM $""% temp%/FileList2.txt "> >"% temp%/FileDate2.txt "findstr / I": * / .OWM $""% temp%/FileList2.txt "> >"% temp%/FileDate2.txt ">"% ftpDown% "echo.%ftpUser% > >"% ftpDown% "echo.%ftpPass% > >"% ftpDown% "echo bin > >"% ftpDown% "echo cd"% ftpFolder% "(for / f" usebackq tokens=1-10 delims=: "% an in ("% temp%/FileDate2 ") .txt ") do (setlocal enabledelayedexpansion if"% f "equ" Jan "(set FileM=01) else if"% f "equ" Feb "(set FileM=02) else if"% f "equ" Mar "(set FileM=03) else if"% f "equ" Apr "(set FileM=04) else if"% f "equ" May "(set FileM=05) else if"% f "equ" Jun "(set FileM=06) else if "% f" equ "Jul" (set FileM=07) else if "% f" equ "Aug" (set FileM=08) else if "% f" equ "Sep" (set FileM=09) else if "% f" equ "Oct" (set FileM=10) else if "% f" equ "Nov" (set FileM=11) else if "% f" equ "Dec" (set FileM=12) set FileD=10%%g set FileDuring FileDholism Set FileH=10%%h set FileHazard FILEHRAPHULY 2! If "! FileM!" Equ "% DstMonth%" (if "! FileD!" Equ "% DstDay%" (if "! FileH!" Equ "% DstHour%" (echo get "% j"% DownFolder%/%%j")) endlocal) > > "% ftpDown%" > > "% ftpDown%" echo byestart ftp-v-I-s: "% ftpDown%"% ftpIP%rem adjust the delay time rem ping-n 700 127.1 > nulgoto: eof:DateToMins% yy%% mm%% dd%% hh%% mm%setlocal ENABLEEXTENSIONSset yy=%1 & set mm=%2&set dd=%3&set hh=%4&set nn=%5if 1% y% LSS 200 if 1% y% LSS 170 (set yy=20%yy%) else (set yy=19%yy%) set / a dd=100%dd%%0 Mm=100%mm%%0set / a zonal 14mm maxim mai Zhe Zhe 12pm Ye Yi Yi Mong Meng 12m Ling Zi 3 J=153*m+2set / a j=j/5+dd+y*365+y/4-y/100+y/400-2472633if 1% hh% LSS 20 set hh=0%hh%if {% nn:~2,1%} EQU {p} if "% hh%" NEQ "12" set hh=1%hh%&set/a hh-=88if {a} EQU "% hh%" EQU "12" set hh=00if {% nn:~2,1%} GEQ {a} set nn=%nn:~0,2%set / a hh=100%hh%%0,nn=100%nn%%0 J=j*1440+hh*60+nnendlocal&set% 6=%j%&goto: EOF:MinsToDate% mins% yy mm dd hh nnsetlocal ENABLEEXTENSIONSset / axiang% 1Magnetici% 60memoir%% 24ddmai% 24ddmai pencils 24pyrus 24set / an axioms 2472632 pencils baccarat 3memorials, 146097cinematic words, 146097memes, 146097pencils, aset / a dancers, cymbals, 3genres, 1461pics, 1461pics, 1461pics, 4parallels, cymbals, 5primes, 5primers, 2mbits, 153des, 153mbits, 2ddls, 5sets / a dd=-dd+e+1,mm=-m/10,mm*=12,mm+=m+3. Yy=b*100+d-4800+m/10 (if% mm% LSS 10 set mm=0%mm%) & (if% dd% LSS 10 set dd=0%dd%) (if% hh% LSS 10 set hh=0%hh%) & (if% nn% LSS 10 set nn=0%nn%) endlocal&set% 6=%nn%&set% 5=%hh%&set% 4 percent d% & ^ set% 3=%mm%&set% 2=%yy%&goto: EOF above is "how to batch download the specified score on the FTP server" The document before the hour "all the contents of this article Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: File server service time article content actual situation delay adjustment not much location address place most password date more format user Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn OPPO Reno NVidia Redmi Shulou Tech Info