From 1fa9ac60d0ee0cc8e69b6b13e7ba33bd048ef34d Mon Sep 17 00:00:00 2001 From: Thomas Klaehn Date: Tue, 9 Aug 2022 15:53:19 +0200 Subject: [PATCH] Imitial commit --- .gitignore | 3 +++ .vscode/launch.json | 17 +++++++++++++++++ file_mover/main.py | 28 ++++++++++++++++++++++++++++ setup.py | 21 +++++++++++++++++++++ 4 files changed, 69 insertions(+) create mode 100644 .gitignore create mode 100644 .vscode/launch.json create mode 100644 file_mover/main.py create mode 100644 setup.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6873ea6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +build/ +dist/ +*.egg-info \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..cb0e010 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,17 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Python: Current File", + "type": "python", + "request": "launch", + "program": "${file}", + "args": ["/home/tkl/2", "/home/tkl/4"], + "console": "integratedTerminal", + "justMyCode": true + } + ] +} \ No newline at end of file diff --git a/file_mover/main.py b/file_mover/main.py new file mode 100644 index 0000000..b19ac77 --- /dev/null +++ b/file_mover/main.py @@ -0,0 +1,28 @@ +import argparse +import os +import shutil +import sys +import time + +def parse_args(): + '''Shell argument parser.''' + parser = argparse.ArgumentParser() + parser.add_argument('infolder', help='Specify the in folder.') + parser.add_argument('outfolder', help='Specify the out folder.') + return parser.parse_args() + + +def main(): + '''Entry point''' + args = parse_args() + run_condition = True + while run_condition: + files = os.listdir(args.infolder) + for file in files: + shutil.move(os.path.join(args.infolder, file), os.path.join(args.outfolder, file)) + time.sleep(10) + return 0 + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..ec0d2cb --- /dev/null +++ b/setup.py @@ -0,0 +1,21 @@ + +import os +import shutil +import stat +from setuptools import setup +from setuptools.command.install import install + +NAME = 'file_mover' +VERSION = '1' +AUTHOR = 'Thomas Klaehn' +EMAIL = 'tkl@blackfinn.de' +PACKAGES = [NAME] + +ENTRY_POINTS = { + 'console_scripts': [ + 'file_mover = file_mover.main:main' + ] +} + +setup(name=NAME, version=VERSION, long_description=__doc__, author=AUTHOR, author_email=EMAIL, + packages=PACKAGES, zip_safe=False, entry_points=ENTRY_POINTS)