feature: create output dir script
This commit is contained in:
parent
befcf0bf99
commit
73462e4b83
4 changed files with 25 additions and 16 deletions
|
@ -1,12 +1,11 @@
|
||||||
from constants import SOURCE
|
from constants import SOURCE
|
||||||
from constants import TARGET
|
from constants import TARGET
|
||||||
from copy_zettels import copy_zettels
|
from lib.create_source_dir import create_source_dir
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
print("this is the app")
|
output_dir = create_source_dir()
|
||||||
print(SOURCE)
|
print(output_dir)
|
||||||
copy_zettels()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
SOURCE = "/home/thomas/repos/eolas"
|
SOURCE = "/home/thomas/repos/eolas"
|
||||||
TARGET = "/home/thomas/repos/output"
|
TARGET = "/home/thomas/Desktop/output"
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
import os
|
|
||||||
import shutil
|
|
||||||
from constants import SOURCE, TARGET
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
|
|
||||||
def copy_zettels():
|
|
||||||
if os.path.isdir(TARGET):
|
|
||||||
shutil.rmtree(TARGET)
|
|
||||||
|
|
||||||
# p.mkdir()
|
|
21
src/lib/create_source_dir.py
Normal file
21
src/lib/create_source_dir.py
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
import uuid
|
||||||
|
from termcolor import colored
|
||||||
|
from constants import SOURCE, TARGET
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
|
def create_source_dir():
|
||||||
|
unique_dir_name = uuid.uuid4()
|
||||||
|
if os.path.isdir(TARGET):
|
||||||
|
shutil.rmtree(TARGET)
|
||||||
|
|
||||||
|
# Create route directory and /static directory
|
||||||
|
os.makedirs(f"{TARGET}/{str(unique_dir_name)}/static")
|
||||||
|
print(
|
||||||
|
colored(
|
||||||
|
f"Created new Neuron output directory: {SOURCE}/{unique_dir_name}", "green"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return unique_dir_name
|
Loading…
Add table
Reference in a new issue