Imitial commit

This commit is contained in:
Thomas Klaehn 2022-08-09 15:53:19 +02:00
commit 1fa9ac60d0
4 changed files with 69 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
build/
dist/
*.egg-info

17
.vscode/launch.json vendored Normal file
View File

@ -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
}
]
}

28
file_mover/main.py Normal file
View File

@ -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())

21
setup.py Normal file
View File

@ -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)