-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
READCOM_MakeHTML.bat
55 lines (38 loc) · 1.4 KB
/
READCOM_MakeHTML.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
@echo off
echo Syntax: READCOM_MakeHtml [file^|folder]
echo Processes Gallery subfolder by default
::--------------------------------
if not exist "%~dp0READCOM_App.exe" echo %~dp0READCOM_App.exe (need at least version 0.7.13) not found & pause & exit 1
SET param=%1
if "%param%"=="" SET param=Gallery
if exist %param%\nul (
call :processFolder "%param%"
) else (
call :processFile "%param%"
)
pause
exit 0
::--------------------------------
:processFolder
if "%~nx1"==".thumbs" exit /B
if "%~nx1"==".html" exit /B
if "%~nx1"==".git" exit /B
echo:
echo Processing folder %1
:: *** TODO: SEEMS TO NOT BE DELETING HTML IMAGES SUBFOLDER AND FAILING TO UPDATE IMAGE IF THAT SUBFOLDER EXISTS (could also see if READCOM_App should be fixed to ALWAYS overwrite existing image and .html when using command-line option ***
:: Process files
if exist "%~df1\.html" echo Clearing subfolder ".html" & (for /D %%d in (%~df1\.html\*.*) do rmdir "%%d" /S /Q)
for %%f in (%1\*.readcom) do call :processFile "%%f"
:: Process subfolders
for /D %%d in (%1\*.*) do call :processFolder "%%d"
exit /B
::--------------------------------
:processFile
:: Note that %~dp1 always ends with a \
if not exist "%~dp1.html" echo Creating subfolder ".html" & md "%~dp1.html"
echo Saving HTML for %1
%~dp0READCOM_App -html "%~f1"
:: Move to .html subfolder
move /Y %1.html "%~dp1.html\" >NUL
move /Y %1.html_Images "%~dp1.html\" >NUL
exit /B