Creating multiple directories simultaneously

Jerry freebsd.user at
Fri Mar 26 17:01:27 UTC 2010

On Fri, 26 Mar 2010 09:28:15 -0700, Charlie Kester
<corky1951 at> articulated:

> For extra credit, and to test your understanding, see if you can
> explain how the following work:
> $ mkdir -p FOO/{foo-,bar-}{1,2,3}
> $ cp foo{,.bak}

Maybe I am doing this wrong; however, I had to use the "-R" flag with
'cp' to make it work. I also assume you meant "FOO" and not "foo"
unless I am completely misunderstanding this exercise.

cp -R FOO{,.bak}
FOO -> FOO.bak/FOO
FOO/foo-1 -> FOO.bak/FOO/foo-1
FOO/foo-2 -> FOO.bak/FOO/foo-2
FOO/foo-3 -> FOO.bak/FOO/foo-3
FOO/bar-1 -> FOO.bak/FOO/bar-1
FOO/bar-2 -> FOO.bak/FOO/bar-2
FOO/bar-3 -> FOO.bak/FOO/bar-3

FreeBSD.user at

Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the Reply-To header.

Please remain calm, it's no use both of
us being hysterical at the same time.

More information about the freebsd-questions mailing list