Reputation:
I am trying to save to multiple locations but get the error message below.
files = os.listdir(path)
NotADirectoryError: [WinError 267] The directory name is invalid: 'C:\\Users\\ze\\ga.csv'
Any ideas on how to fix this?
#!/usr/bin/python
import sys, os, time, shutil
print(time.ctime())
path = 'C:\\Users\\ze\\ga.csv'
files = os.listdir(path)
files.sort()
for f in files:
src = path+f
dst = 'C:\\Users\\ze\\ga.csv' +f
dst2 = 'C:\\Users\\ze\\ga.csv' +f
dst3 = 'C:\\Users\\ze\\ga.csv' +f
shutil.move(src, dst)
print(time.ctime())
Upvotes: 0
Views: 511
Reputation: 5591
I have few python scripts where I also faced the same problem and I have modified the path like below which fixed my problem.
path = "C:/Users/ze/ga.csv"
Upvotes: 1