15
I have several threads each of which is changing working directories and occasionally creating new ones in specific working directories, copying/moving files etc in these directories. Think e.g.:
def thread1:
while True:
os.chdir('dir')
os.mkdir('newdir')
os.system('mv *.png newdir/')
do something
def thread2:
while True:
os.chdir('another-dir')
os.mkdir('another-newdir')
os.system('mv *.png another-newdir/')
do something
I've read that chdir, mkdir functions are not specific to threads but global. What is a way to accomplish this? I can try to use absolute paths but is that the best solution?