The task is to sort the archive of different Web documents.
There is a plenty (about 5 thousands) of files named the following way:
number(3-6 digits)_name_.zip(jar,sis)
And the same amount of images in 'Screens' folder:
number(3-6 digits).jpg(gif,png)
Alse there are Web pages in 'Html' folder:
number(3-6 digits).htm(html)
Is it possible to write a batch script that creates folders named after a file and move there a file, a picture and a Web page? ZIP archive should be also extracted there.
The batch script to solve this task looks like this:
@Echo Off
Set ArcDir=c:\archives
Set ScreenDir=c:\screens
Set HTMLDir=c:\html
Set OutDir=C:\
For %%A In (%ArcDir%\*.zip %ArcDir%\*.jar %ArcDir%\*.sys) Do (
md "%%~nA">Nul 2>&1
If /I "%%~xA"==".zip" (
pkzip -extr=up "%%A" "%OutDir%\%%~nA">Nul 2>&1
) Else (
Copy /y "%%A" "%OutDir%\%%~nA">Nul 2>&1
)
Copy /y "%ScreenDir%\%%~nA.*" "%OutDir%\%%~nA">Nul 2>&1
Copy /y "%HTMLDir%\%%~nA.html" "%OutDir%\%%~nA">Nul 2>&1
)
Hope you'll find this example useful. You can modify this script with the help of our batch files editor called Dr.Batcher.
There is a plenty (about 5 thousands) of files named the following way:
number(3-6 digits)_name_.zip(jar,sis)
And the same amount of images in 'Screens' folder:
number(3-6 digits).jpg(gif,png)
Alse there are Web pages in 'Html' folder:
number(3-6 digits).htm(html)
Is it possible to write a batch script that creates folders named after a file and move there a file, a picture and a Web page? ZIP archive should be also extracted there.
The batch script to solve this task looks like this:
@Echo Off
Set ArcDir=c:\archives
Set ScreenDir=c:\screens
Set HTMLDir=c:\html
Set OutDir=C:\
For %%A In (%ArcDir%\*.zip %ArcDir%\*.jar %ArcDir%\*.sys) Do (
md "%%~nA">Nul 2>&1
If /I "%%~xA"==".zip" (
pkzip -extr=up "%%A" "%OutDir%\%%~nA">Nul 2>&1
) Else (
Copy /y "%%A" "%OutDir%\%%~nA">Nul 2>&1
)
Copy /y "%ScreenDir%\%%~nA.*" "%OutDir%\%%~nA">Nul 2>&1
Copy /y "%HTMLDir%\%%~nA.html" "%OutDir%\%%~nA">Nul 2>&1
)
Hope you'll find this example useful. You can modify this script with the help of our batch files editor called Dr.Batcher.
No comments:
Post a Comment