-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmpay2ynab.bat
More file actions
39 lines (33 loc) · 1.28 KB
/
mpay2ynab.bat
File metadata and controls
39 lines (33 loc) · 1.28 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
@echo off
setlocal EnableDelayedExpansion
REM This script takes in two arguments: the first is the path to the file to be converted, and the second is the path to the output file.
REM Usage: mpay2ynab.bat <input_file> <output_file>
REM where <input_file> is the path to the BOC xls file and <output_file> is the path to the YNAB CSV file.
REM This script simply calls the Python script mpay2ynab.py with the provided arguments.
REM Check if the correct number of arguments is provided
if "%~1"=="" (
echo Usage: mpay2ynab.bat ^<input_file^> ^<output_file^>
exit /b 1
)
set "input_file=%~1"
if "%~2"=="" (
echo No output file specified, using default output file: "%~dpn1.csv"
set "output_file=%~dpn1.csv"
) else (
set "output_file=%~2"
)
REM Check if the input file exists
if not exist "%input_file%" (
echo Input file "%input_file%" does not exist.
exit /b 1
)
REM Check if the output file already exists
if exist "%output_file%" (
set /p overwrite_choice="Output file %output_file% exists. Overwrite? [y/N] "
if /i "!overwrite_choice!" neq "y" (
echo Exiting without overwriting.
exit /b 1
)
)
REM Call the Python script with the provided arguments
uv run "%~dp0mpay2ynab.py" "%input_file%" "%output_file%"