Unverified Commit e0cb3ec4 authored by Robin Mueller's avatar Robin Mueller
Browse files

renaming, file mgmt added

parent 410ec8b6
......@@ -2,7 +2,7 @@ import re
from typing import List
from modgen.parserbase.parser import FileParser
from modgen.utility.mib_printer import PrettyPrinter
from modgen.utility.printer import PrettyPrinter
# Intermediate solution
MAX_STRING_LEN = 80
......
......@@ -12,7 +12,7 @@
14.11.2019
"""
from utility import mib_globals as g
from utility.mib_file_management import copy_file, move_file
from modgen.utility.file_management import copy_file, move_file
# TODO: Export to SQL
......
#! /usr/bin/python3.8
# -*- coding: utf-8 -*-
import shutil
import os
def copy_file(filename: str, destination: str = "", delete_existing_file: bool = False):
if os.path.exists(filename):
try:
shutil.copy2(filename, destination)
except FileNotFoundError as error:
print("copy_file: File not found!")
print(error)
except shutil.SameFileError:
print("copy_file: Source and destination are the same!")
def move_file(file_name: str, destination: str = ""):
if os.path.exists(file_name):
try:
shutil.copy2(file_name, destination)
os.remove(file_name)
except FileNotFoundError as error:
print("File not found!")
print(error)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment