Last active
May 6, 2017 09:34
-
-
Save hatemhosny/5f99853de0e3fb48f67274c825cf1d68 to your computer and use it in GitHub Desktop.
Create list of courses placed in multiple folders
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
cd %~dp0 | |
REM Create text list | |
dir /b /o:n /a:d > list.txt | |
for /D %%a in (*) do ( | |
@echo. >> list.txt | |
@echo. >> list.txt | |
@echo ---------- %%a ---------- >> list.txt | |
@echo. >> list.txt | |
cd "%%a" | |
dir /b /o:n /a:d >> ..\list.txt | |
cd .. | |
) | |
REM Create html list | |
echo ^<head^>^<head^>^<title^>Course List^<^/title^>^<^/head^>^<body^>^<h1^>Course List^<^/h1^> > list.html | |
for /D %%a in (*) do ( | |
@echo ^<a href="#%%a"^>%%a^<^/a^>^<br ^/^> >> list.html | |
) | |
echo ^<p^>^<pre^> >> list.html | |
for /D %%a in (*) do ( | |
echo ^<^p ^/^>^<^p ^/^> >> list.html | |
@echo ^<div id="%%a"^>---------- %%a ----------^<^/div^> >> list.html | |
cd "%%a" | |
dir /b /o:n /a:d >> ..\list.html | |
cd .. | |
) | |
echo ^<^/pre^> >> list.html | |
echo ^<^/p^>^<^/body^>^<^/head^> >> list.html | |
REM Copy lists | |
copy list.txt D:\Courses\list.txt /Y | |
copy list.html D:\Courses\list.html /Y |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment