-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbarcodescansplit.bat
More file actions
87 lines (77 loc) · 2.94 KB
/
barcodescansplit.bat
File metadata and controls
87 lines (77 loc) · 2.94 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
@echo off
setlocal enabledelayedexpansion
cd /d "%~dp0"
REM Initialize variables
set "SOURCE="
set "DESTINATION="
set "BACKUP="
set "LOG="
set "TEMP="
set "IMAGE="
set "MODE="
set "PROCESSES=%NUMBER_OF_PROCESSORS%"
REM Function to display usage
:display_usage
echo Usage: %~n0 [OPTIONS]
echo.
echo Options:
echo -s, --source Directory containing PDF files.
echo -d, --destination Directory to store output files.
echo -b, --backup Directory to store backup files.
echo -l, --log Directory to store log files.
echo -t, --temp Temporary directory to store split files.
echo -i, --image Temporary directory to store images.
echo -m, --mode Processing mode (single or multi).
echo -p, --processes Maximum number of processes to run (default: number of CPU threads).
echo -h, --help Display this help message and exit.
echo.
echo Example: %~n0 -s "C:\Source" -d "C:\Dest" -m single
exit /b 1
REM Parse arguments
:parse_args
if "%~1"=="" goto end_args
if "%~1"=="--source" (set "SOURCE=%~2" & shift & shift & goto parse_args)
if "%~1"=="-s" (set "SOURCE=%~2" & shift & shift & goto parse_args)
if "%~1"=="--destination" (set "DESTINATION=%~2" & shift & shift & goto parse_args)
if "%~1"=="-d" (set "DESTINATION=%~2" & shift & shift & goto parse_args)
if "%~1"=="--backup" (set "BACKUP=%~2" & shift & shift & goto parse_args)
if "%~1"=="-b" (set "BACKUP=%~2" & shift & shift & goto parse_args)
if "%~1"=="--log" (set "LOG=%~2" & shift & shift & goto parse_args)
if "%~1"=="-l" (set "LOG=%~2" & shift & shift & goto parse_args)
if "%~1"=="--temp" (set "TEMP=%~2" & shift & shift & goto parse_args)
if "%~1"=="-t" (set "TEMP=%~2" & shift & shift & goto parse_args)
if "%~1"=="--image" (set "IMAGE=%~2" & shift & shift & goto parse_args)
if "%~1"=="-i" (set "IMAGE=%~2" & shift & shift & goto parse_args)
if "%~1"=="--mode" (set "MODE=%~2" & shift & shift & goto parse_args)
if "%~1"=="-m" (set "MODE=%~2" & shift & shift & goto parse_args)
if "%~1"=="--processes" (set "PROCESSES=%~2" & shift & shift & goto parse_args)
if "%~1"=="-p" (set "PROCESSES=%~2" & shift & shift & goto parse_args)
if "%~1"=="--help" (goto display_usage)
if "%~1"=="-h" (goto display_usage)
echo Unknown option: %~1
exit /b 1
:end_args
REM Validate required arguments
if "%SOURCE%"=="" (
echo Error: -s/--source is required.
goto display_usage
)
if "%DESTINATION%"=="" (
echo Error: -d/--destination is required.
goto display_usage
)
if "%MODE%"=="" (
echo Error: -m/--mode is required.
goto display_usage
)
REM Print parsed arguments
echo Source directory: %SOURCE%
echo Destination directory: %DESTINATION%
echo Backup directory: %BACKUP%
echo Log directory: %LOG%
echo Temporary directory for splits: %TEMP%
echo Temporary directory for images: %IMAGE%
echo Processing mode: %MODE%
echo Maximum processes: %PROCESSES%
REM Add your processing logic below this line
REM ...