Reputation: 2896
Please find my python script below:
import os;
import sys;
dir_dst = sys.argv[1]
for x in range(150) :
dirname = str(x)
dst_dir = os.path.join(dir_dst, dirname)
dirname = "annotation"
dst = os.path.join(dst_dir, dirname)
print dst
if not os.path.exists(dst_dir):
os.mkdir(dst)
The aim is to create a directory called "annotation" within each of the numbered directories ranging as in the code above. This code doesn't do it and on printing the value of "dst", here's an example of what it shows:
NLP/test data/reconcile/0\annotation
NLP/test data/reconcile/1\annotation
How can this be resolved?
Upvotes: 0
Views: 98
Reputation: 78600
Change the second to last line to
if not os.path.exists(dst):
Right now you're checking if the original directory exists.
Upvotes: 4