I am new to python.
I have a set of commands which I want to convert to a python script.
commands are
foreach f (`cat ../etc/l.list`)
echo $f
mkdir "$f"
cd "$f"
cp ../r/"$f".txt .
cd ..
end
I succeded in creating folders with respective names as listed in l.list,
but struggling to copy respective files "$f".txt to respective f folders
this is what i put down till now
import os, sys
import shutil
fil = open("../etc/l.list")
lines = fil.readlines()
fil.close()
for f in lines:
dirname = "f"
if not os.path.isdir("./" + f + "/"):
os.mkdir("./" + f + "/")
can sobody tell me how to copy. tried copytree, but failed.