I apologize in advance if I am posting this in the wrong location, I am very new to scripting let alone stackoverflow:
I have a number of files ending in .conf
in the same directory as a number of folders with the same names without the .conf
extension. For example, my directory looks like this:
136
136.conf
139
139.conf
...
I would like to move the .conf
files into their corresponding folder with a loop. I thought I could do this:
for f in *.conf; do
dir=${f:0:13}
mv "$f" "$dir"
done
but I am obviously doing something incorrectly. I would greatly appreciate anyone's help with this.