I have a directory which contains several folders. I'd like to make a bash script to create directories with the same name in a different location.
Note that I don't want to copy the folder structure, neither copy or move the folders. I just want to create folders with the same name in a different location.
I'm stuck. Using this:
for d in "template/modules/*"
do
# mkdir $(basename "$d");
echo $d;
echo "$d";
echo $(basename "$d");
done
Output:
template/modules/introduction template/modules/kitchen template/modules/test
template/modules/*
add_module.sh template
Any ideas?
Cheers
You need to put the asterisk outside the quotes:
for d in "template/modules/"*
In the first echo
, $d
is expanded, but when you quote it, it's not.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With