Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfile_list.bat
More file actions
Latest commit
44 lines (39 loc) · 1.42 KB
/
Copy pathfile_list.bat
File metadata and controls
44 lines (39 loc) · 1.42 KB
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
@echooff
setlocalEnableDelayedExpansion
REM All parameters are required. This way, users can't pass empty string as parameter.
setinvalidArgs=0
setpathNotProvided=0
if [%1] ==""setinvalidArgs=1
if [%2] ==""setinvalidArgs=1
if [%3] ==""setinvalidArgs=1
if%invalidArgs%==1 (
echo Usage: ut_run.bat "project_path""sql_param_name""output_file""scan_path"
exit /b 1
)
REM Expand relative path from parameter to be a full path
setprojectPath=%~f1
setsqlParamName=%~2
setoutputFile=%~3
setscanPath=%~4
REM Remove trailing slashes.
if%projectPath:~-1%==\ setprojectPath=%projectPath:~0,-1%
if [%scanPath%] == [] (set pathNotProvided=1) else (set "fullScanPath=%projectPath%\%scanPath%")
ifnotexist"%fullScanPath%\*"setpathNotProvided=1
if%pathNotProvided%==1 (
echo begin>%outputFile%
echo^ open :%sqlParamName% for select null from dual where 1 = 0;>>%outputFile%
echo end;>>%outputFile%
echo />>%outputFile%
exit /b 0
)
echo declare>%outputFile%
echo^ l_list ut_varchar2_list := ut_varchar2_list();>>%outputFile%
echo begin>>%outputFile%
for /f "tokens=* delims= "%%ain ('dir %fullScanPath%\* /B /S /A:-D') do (
set"filePath=%%a"
setfilePath=!filePath:%projectPath%\=!
echo^ l_list.extend; l_list^(l_list.last^) := '!filePath!^';>>%outputFile%
)
echo^ open :%sqlParamName% for select * from table(l_list);>>%outputFile%
echo end;>>%outputFile%
echo />>%outputFile%