-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathv2-beta.py
More file actions
executable file
·31 lines (27 loc) · 800 Bytes
/
v2-beta.py
File metadata and controls
executable file
·31 lines (27 loc) · 800 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#! /usr/bin/env python3
import os
import shutil
def move_function(args, directory):
shutil.move(args, directory)
# Creatinge Home Directory for reference
homedir = os.environ['HOME']
homedir = homedir + "/"
downloaddir = homedir + "Downloads"
# reading file
with open('config', encoding='utf-8') as a_file:
for a_line in a_file:
line = a_line[:1]
if (line == "*"):
extractdir = a_line[1::]
workingdir = homedir + extractdir
print(workingdir)
if (line == "#"):
os.chdir(downloaddir)
file_extension = a_line[1::]
file_extension = file_extension.rstrip('\n')
for root, dirs, files in os.walk(downloaddir):
for f_name in files:
if f_name.endswith(file_extension):
print(f_name)
print(workingdir)
shutil.move(f_name, workingdir)