-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGetCode.bat
More file actions
65 lines (52 loc) · 971 Bytes
/
GetCode.bat
File metadata and controls
65 lines (52 loc) · 971 Bytes
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
56
57
58
59
60
61
62
63
64
65
@ECHO OFF
SETLOCAL EnableDelayedExpansion
SET fpath=%1
SET absdir=%CD%
SET /a len=0
ECHO %absdir% > x & FOR %%? IN (x) DO SET /A len=%%~z? - 3&del x
SET fpath=%absdir%\%fpath%
ECHO Starting .cpp files
PUSHD src
FOR /D %%G IN (*) DO (
PUSHD %%G
CALL :IntoSub
)
CALL :PrintFiles
popd
ECHO Starting .h files
PUSHD h
FOR /D %%G IN (*) DO (
PUSHD %%G
CALL :IntoSub
)
CALL :PrintFiles
popd
GOTO :eof
:IntoSub
FOR /D %%H IN (*) DO (
IF EXIST %%H (
PUSHD %%H
CALL :IntoSub
)
)
CALL :PrintFiles
popd
GOTO :eof
:PrintFiles
IF NOT EXIST *.cpp IF NOT EXIST *.h GOTO :eof
ECHO Files in: %CD%
SET rel=%CD%
SET rel=!rel:~%len%!
SET rel=!rel:\=/!
SET relsrc=/!rel!
SET relsrc=!relsrc:/h/=src/!
SET relsrc=!relsrc:/src/=src/!
IF NOT !relsrc! == !rel! (
SET relsrc=!relsrc!/h
)ELSE SET relsrc=!rel!
ECHO ["!relsrc!"]>>%fpath%
ECHO (!rel!)>>%fpath%
FOR %%J IN (*) DO (
ECHO %%J>>%fpath%
)
GOTO :eof