Re: scripting question
On Die, 15 Apr 2003 at 17:18 (-0700), Maria Rodriguez wrote:
> I've got a scripting question for you bash lovers out there.
> I have a directory that has a lot of subdirectories, only one of which I want to keep. Let's say I want to keep only the "B" subdirectory below:
> Is there a way >>> on the command line <<< to remove all the directories other than B? I thought there might be a way to do this with "find" but nothing I've tried yet seems to work.
cd /path && rm -rf [^B]* B?*
First pattern matches all filenames _not_ beginning with a B and
second matches all filenames beginning with a B, but having at least
two characters in their name.