I have a situation where I have a group of directories like this:
foo
foo_01
foo_02
foo_03
Each one of these 4 directories contains files. What I am trying to do is create a script which copies all of the files out of foo_01, foo_02 and foo_03 into the foo directory, then deletes the source directories so that I’m always just left with the foo directory only. This needs to happen in a loop because there will be an unknown number directories to copy.
I think what needs to happen is to first identify all directories which contain the character string “foo_”, and I’m thinking that could be done using a wildcard, but I’m having trouble figuring out exactly how to do this. Any thoughts/suggestions??
Thanks in advance for any assistance.