Skip to content

Commit 83c45bb

Browse files
committed
Session 5 related
1 parent 94a559e commit 83c45bb

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/python
2+
3+
4+
#Find and print file locations
5+
import pathlib
6+
pth = pathlib.Path('./')
7+
abpth = pth.absolute()
8+
for fn in pth.iterdir():
9+
print(str(abpth) + '\\' + str(fn))
10+
11+
# Copy file to designated location
12+
file_name = input ('file_name with file type: ')
13+
#'classinfo.txt'
14+
out_loc = input('Copy location (/): ')
15+
#'/Python Class/Copied Files/'
16+
with open(file_name, 'r') as f:
17+
read_data = f.read()
18+
f.closed
19+
#'/Python Class/Copied Files/classinfo_copy.txt'
20+
out_file = out_loc + "/" + file_name
21+
with open(out_file, 'w') as f1:
22+
for line in read_data:
23+
f1.write(line)
24+
25+

0 commit comments

Comments
 (0)