-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMoveFile_ToBackupv2.py
More file actions
executable file
·55 lines (44 loc) · 1.81 KB
/
MoveFile_ToBackupv2.py
File metadata and controls
executable file
·55 lines (44 loc) · 1.81 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import shutil
import os
source_path = input('Enter source path:\n')
destination = input('Enter the destination path:\n')
extension = input('Enter extension for files (.jpg, .jpeg, .png, .mp4, .txt, .pdf) to move:\n')
if extension == '.jpg':
os.chdir(source_path)
print(f'Current path is {source_path}.\n')
mv_jpg = f'mv *{extension} {destination}'
os.system(mv_jpg)
print(f'File type of {extension} has been moved to {destination}.\nVerify results\n')
elif extension == '.jpeg':
os.chdir(source_path)
print(f'Current path is {source_path}.\n')
mv_jpeg = f'mv *{extension} {destination}'
os.system(mv_jpeg)
print(f'File type of {extension} has been moved to {destination}.\nVerify results\n')
elif extension == '.png':
os.chdir(source_path)
print(f'Current path is {source_path}.\n')
mv_png = f'mv *{extension} {destination}'
os.system(mv_png)
print(f'File type of {extension} has been moved to {destination}.\nVerify results\n')
elif extension == '.mp4':
os.chdir(source_path)
print(f'Current path is {source_path}.\n')
mv_mp4 = f'mv *{extension} {destination}'
os.system(mv_mp4)
print(f'File type of {extension} has been moved to {destination}.\nVerify results\n')
elif extension == '.txt':
os.chdir(source_path)
print(f'Current path is {source_path}.\n')
mv_txt = f'mv *{extension} {destination}'
os.system(mv_txt)
print(f'File type of {extension} has been moved to {destination}.\nVerify results\n')
elif extension == '.pdf':
os.chdir(source_path)
print(f'Current path is {source_path}.\n')
mv_pdf = f'mv *{extension} {destination}'
os.system(mv_pdf)
print(f'File type of {extension} has been moved to {destination}.\nVerify results\n')
else:
print(f'Selection of {extension} type is not correct.\n')
exit()