Creating multiple directories simultaneously
I could have sworn that I saw a method of creating several directories, actually a parent direct and several sub-directories simultaneously; however, I cannot fine the documentation any longer. Assume I want to create a directory: FOO with three directories under it, foo-1, foo-2 and foo-3. I tried: mkdir -p foo {foo-1, foo-2, foo-3} and several other variants and they all failed. I could easily write a simple script to accomplish it; however, I thought I could do it directly from the command line. -- Jerry freebsd.u...@seibercom.net Disclaimer: off-list followups get on-list replies or get ignored. Please do not ignore the Reply-To header. __ The only real way to look younger is not to be born so soon. Charles Schulz, Things I've Had to Learn Over and Over and Over ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Creating multiple directories simultaneously
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 26.03.2010 12:12, Jerry wrote: I could have sworn that I saw a method of creating several directories, actually a parent direct and several sub-directories simultaneously; however, I cannot fine the documentation any longer. Assume I want to create a directory: FOO with three directories under it, foo-1, foo-2 and foo-3. I tried: mkdir -p foo {foo-1, foo-2, foo-3} and several other variants and they all failed. I could easily write a simple script to accomplish it; however, I thought I could do it directly from the command line. did you try mkdir -p dirtest/dir1 dirtest/dir2 dirtest/dir3 ? //Svein - -- - +---+--- /\ |Svein Skogen | sv...@d80.iso100.no \ / |Solberg Østli 9| PGP Key: 0xE5E76831 X|2020 Skedsmokorset | sv...@jernhuset.no / \ |Norway | PGP Key: 0xCE96CE13 | | sv...@stillbilde.net ascii | | PGP Key: 0x58CD33B6 ribbon |System Admin | svein-listm...@stillbilde.net Campaign|stillbilde.net | PGP Key: 0x22D494A4 +---+--- |msn messenger: | Mobile Phone: +47 907 03 575 |sv...@jernhuset.no | RIPE handle:SS16503-RIPE - +---+--- If you really are in a hurry, mail me at svein-mob...@stillbilde.net This mailbox goes directly to my cellphone and is checked even when I'm not in front of my computer. - Picture Gallery: https://gallery.stillbilde.net/v/svein/ - -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.12 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkuslzgACgkQODUnwSLUlKT2hwCaAuTsd/NUacDAMYWW6vYFNl2S qykAnRT8ox6UMTO1OsnCvVfg18CF/Qi7 =nPew -END PGP SIGNATURE- ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Creating multiple directories simultaneously
On Fri, 26 Mar 2010 07:12:48 -0400, Jerry wrote: I could have sworn that I saw a method of creating several directories, actually a parent direct and several sub-directories simultaneously; however, I cannot fine the documentation any longer. Assume I want to create a directory: FOO with three directories under it, foo-1, foo-2 and foo-3. I tried: mkdir -p foo {foo-1, foo-2, foo-3} and several other variants and they all failed. I could easily write a simple script to accomplish it; however, I thought I could do it directly from the command line. try mkdir -p foo{,-1,-2,-3} ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Creating multiple directories simultaneously
On Fri, Mar 26, 2010 at 07:12:48AM -0400, Jerry wrote: I could have sworn that I saw a method of creating several directories, actually a parent direct and several sub-directories simultaneously; however, I cannot fine the documentation any longer. Assume I want to create a directory: FOO with three directories under it, foo-1, foo-2 and foo-3. I tried: mkdir -p foo {foo-1, foo-2, foo-3} Almost. $ mkdir -p FOO/{foo-1,foo-2,foo-3} -- Daniel Bye _ ASCII ribbon campaign ( ) - against HTML, vCards and X - proprietary attachments in e-mail / \ pgpGZtGlDJ3t0.pgp Description: PGP signature
Re: Creating multiple directories simultaneously
On Fri, 26 Mar 2010 12:15:04 +0100, Svein Skogen (Listmail Account) svein-listm...@stillbilde.net articulated: did you try mkdir -p dirtest/dir1 dirtest/dir2 dirtest/dir3 ? Yes, and of course it works. I just thought that I had once seen a faster method of accomplishing the same feat. Perhaps I was mistaken. -- Jerry freebsd.u...@seibercom.net Disclaimer: off-list followups get on-list replies or get ignored. Please do not ignore the Reply-To header. __ The meek shall inherit the Earth. (But they're gonna have to fight for it.) ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Creating multiple directories simultaneously
On Fri, 26 Mar 2010 11:32:58 +, Daniel Bye freebsd-questi...@slightlystrange.org articulated: On Fri, Mar 26, 2010 at 07:12:48AM -0400, Jerry wrote: I could have sworn that I saw a method of creating several directories, actually a parent direct and several sub-directories simultaneously; however, I cannot fine the documentation any longer. Assume I want to create a directory: FOO with three directories under it, foo-1, foo-2 and foo-3. I tried: mkdir -p foo {foo-1, foo-2, foo-3} Almost. $ mkdir -p FOO/{foo-1,foo-2,foo-3} Thank you; that is exactly what I was looking for. I knew I had seen it somewhere before. -- Jerry freebsd.u...@seibercom.net Disclaimer: off-list followups get on-list replies or get ignored. Please do not ignore the Reply-To header. __ Blessed are the meek for they shall inhibit the earth. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Creating multiple directories simultaneously
Hi, maybe you need mkdirhier dirtest/dir1 dirtest/dir2 dirtest/dir3 Cheers, Jarek Miszczak On Fri, Mar 26, 2010 at 12:12, Jerry freebsd.u...@seibercom.net wrote: I could have sworn that I saw a method of creating several directories, actually a parent direct and several sub-directories simultaneously; however, I cannot fine the documentation any longer. Assume I want to create a directory: FOO with three directories under it, foo-1, foo-2 and foo-3. I tried: mkdir -p foo {foo-1, foo-2, foo-3} and several other variants and they all failed. I could easily write a simple script to accomplish it; however, I thought I could do it directly from the command line. -- Jerry freebsd.u...@seibercom.net Disclaimer: off-list followups get on-list replies or get ignored. Please do not ignore the Reply-To header. __ The only real way to look younger is not to be born so soon. Charles Schulz, Things I've Had to Learn Over and Over and Over ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Creating multiple directories simultaneously
On Fri 26 Mar 2010 at 04:44:56 PDT Jerry wrote: On Fri, 26 Mar 2010 11:32:58 +, Daniel Bye freebsd-questi...@slightlystrange.org articulated: On Fri, Mar 26, 2010 at 07:12:48AM -0400, Jerry wrote: I could have sworn that I saw a method of creating several directories, actually a parent direct and several sub-directories simultaneously; however, I cannot fine the documentation any longer. Assume I want to create a directory: FOO with three directories under it, foo-1, foo-2 and foo-3. I tried: mkdir -p foo {foo-1, foo-2, foo-3} Almost. $ mkdir -p FOO/{foo-1,foo-2,foo-3} Thank you; that is exactly what I was looking for. I knew I had seen it somewhere before. Or, for even less typing: $ mkdir -p FOO/foo-{1,2,3} Understand how this works, however, so you won't need to look it up again, but can apply it yourself in whatever variation is needed. It's called brace expansion. Here's the first hit that comes up in Google, which describes it fairly well: http://snap.nlc.dcccd.edu/reference/bash1/features_11.html This page is about the bash shell, but brace expansion works the same way in tcsh. It is NOT supported in tne Bourne shell. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Creating multiple directories simultaneously
On Fri 26 Mar 2010 at 08:49:08 PDT Charlie Kester wrote: Understand how this works, however, so you won't need to look it up again, but can apply it yourself in whatever variation is needed. It's called brace expansion. 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} Others might have some even more complicated examples worth exploring. (It sucks, btw, that most of what Google finds pertaining to brace expansion is about bash, when the feature was actually introduced by csh.) ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Creating multiple directories simultaneously
On Fri, 26 Mar 2010 09:28:15 -0700, Charlie Kester corky1...@comcast.net 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 -- Jerry freebsd.u...@seibercom.net 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. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Creating multiple directories simultaneously
On Fri 26 Mar 2010 at 10:01:21 PDT Jerry wrote: On Fri, 26 Mar 2010 09:28:15 -0700, Charlie Kester corky1...@comcast.net 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. Sorry, pedagogical error. I didn't intend that to operate on the results of any of the other examples. I probably should have chosen something other than 'foo' in order to avoid that misunderstanding. The point was simply to explore what happens when one of the terms inside the braces is an empty string. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org