-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFile renamer.py
More file actions
34 lines (22 loc) · 1.03 KB
/
File renamer.py
File metadata and controls
34 lines (22 loc) · 1.03 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
"""
File renamer.py is a python script which is used to move the files from one location to another.
The name of files that are to be moved from one location to another is specified in a text
file called 'Unsupported Files.txt' and the files that are meant to be moved are unsupported
pdf files from the yesterday's work.
The program should be executed once only after the successful execution as it will give error
if the files and folders already exists or are moved to the location.
INCOMPLETE FILE
WORK IS YET TO BE DONE
first check whether the pdf 's content name is null or not call for function name creater
to get a proper name without any problems in the name if it is not null then only check
whether the file name contain the term 'sector' in it, if so then only rename it
"""
import os
import shutil
fileobj = open('Unsupported Files.txt','r')
contents = fileobj.read()
contentlist = contents.split('\n')
os.chdir('H:\\backup\\pdf')
for file in contentlist:
shutil.rename(file,'H:\\backup\\Unsupported pdf\\')
fileobj.close()