This solution (listed below) works, but it doesn’t look like the most practical of solutions. What I want to do is populate a folder with children with a name t_###_u and then fill those child directories with two files (one of which should be renamed to parent directory name and appended with a .c) Can anyone post a better, more elegant solution?
for i in {1..100}
do
mkdir `printf "t_%03d_u" $i`;
cp ./templates/* `printf "t_%03d_u" $i`;
mv `printf "./t_%03d_u/template.c" $i` `printf "./t_%03d_u/t_%03d.c" $i $i`;
done
echo "Did it work?"
Thanks for any help in advance.
seq -wis hugely useful 🙂I’m sure it could be improved a bit further with computing the name of the directory once and re-using it, but this is nicer-enough that I’m fine stopping here. 🙂