In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article is to share with you about how to implement the bat of migrating image directories. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
The code is as follows:
@ echo off
Setlocal enabledelayedexpansion
:: enable variable delay, add custom variable name
Set sourpic=e:\ pic
:: define the picture source
Set despic=e:\ img
:: define the image storage address
Set pictype=*.jpg
:: define picture type
Set log=e:\ log.txt
:: define Log information, which is regenerated every time
Logging at the beginning of rem processing
Echo picture taken from:% sourpic% >% log%
Echo upload directory:% despic% > >% log%
Echo picture type:% pictype% > >% log%
Echo start time:% date%%time% > >% log%
:: after traversing the folder, traverse the corresponding folder one by one, copy pictures, log records, and delete pictures at the same time
For / d% I in (% sourpic%\ *) do (
:: traverses the root folder to get the subfolder name
Set folder=% ~ ni
Echo, yes! folder! Folder for operation
Echo # right! folder! Folder to operate:% date%%time% > >% log%
Rem begins to judge the directory of the server
Call: serverfolder% despic%! folder!% log%
Rem starts traversing the picture files in this folder
Call: copyfile% ~ fi! folder!
)
Echo date%%time%-- operation complete > > log%
Pause
Exit
Rem manages the directory of the target server
: serverfolder
If exist 1 2 (
Directory exists on the echo server side:% 1\% 2
) else (
Echo starts creating directories:% 1\% 2
Md 1 2
If% ERRORLEVEL% = = 0
Echo server side created 1 2 successfully! > > 3
) else (
Failed to create 1 2 on echo server side! > > 3
)
)
Goto:eof
Rem handles files in subfolders
: copyfile
For / r 1 I in (pictype%) do (
Echo starts copying:% I
Echo date%%time%--%%i > > log%
Copy% I% despic%\% 2\% ~ ni%%~xi / y
If% ERRORLEVEL% = = 0
Echo copy succeeded > > log%
Rem starts to delete
Del% I / Q
If% ERRORLEVEL% = = 0
Echo deleted successfully > > log%
) else (
Echo deletion failed > > log%
)
) else (
Echo copy failed > > log%
)
)
Goto:eof
Thank you for reading! This is the end of the article on "how to migrate the bat of the picture directory". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.