lundi 23 mars 2015

convert batch code to python script

Hi I want to convert windows batch file into linux python script. I can able to write python script but I am unable to understand some code of window batch file which I need to convert into linux python script



:vars

:: Main folder
set BASE_DIR=%~dp0

:: Downloadable data
set DATA_DIR=%BASE_DIR%\data.downloadable
set "DBF_DIR=%data_dir%\101\dbf"
set "CSV_DIR_UPDATE=%data_dir%\101\csv.update"
set "CSV_DIR_FULL_ARCHIVE=%data_dir%\101\csv.full"
set "SQL_DIR=%data_dir%\101\sql"
set "RAR_DIR=%data_dir%\101\rarzip"

:: Private data
set "DATA_DIR_PRIVATE=%BASE_DIR%\data.private"
set "FORM_DIR_VEB=%data_dir_private%\veb\form"
set "CSV_DIR_VEB=%data_dir_private%\veb\csv"

:: Output
set "DIR_OUTPUT=%BASE_DIR%\output"


::::::::::::::::::::::::::::::::::::::::
: add some paths
PATH %PATH%;%BASE_DIR%
PATH %PATH%;%BASE_DIR%\task\maintain
PATH %PATH%;%BASE_DIR%\py

::::::::::::::::::::::::::::::::::::::::

if not exist %DATA_DIR% md %DATA_DIR%
if not exist %DBF_DIR% md %DBF_DIR%
if not exist %CSV_DIR_UPDATE% md %CSV_DIR_UPDATE%
if not exist %CSV_DIR_FULL_ARCHIVE% md %CSV_DIR_FULL_ARCHIVE%
if not exist %RAR_DIR% md %RAR_DIR%
if not exist %SQL_DIR% md %SQL_DIR%
if not exist %DIR_OUTPUT% md %DIR_OUTPUT%

echo Directories checked or created...

:end

::::::::::::::::::::::::::::::::::::::::


can you please explain what above code do exactly, atleast give me logic so that I can implement in python script


Aucun commentaire:

Enregistrer un commentaire