Score:7

What is the correct command using brace expansions to create multiple directories?

th flag

Could I use the following command to create multiple directories?:

mkdir ~/backups/freemem/{backups/diskuse,backups/openlist,backups/freedisk}

or

mkdir ~/backups/freemem/{/backups/diskuse/,/backups/openlist/,/backups/freedisk/}
Score:17
us flag

Assuming ~/backups/freemem/backups is an existing directory, both will work, since ~/backups/freemem//backups/diskuse/ and ~/backups/freemem/backups/diskuse are the same as far as mkdir is concerned. But why not simplify that?

mkdir ~/backups/freemem/backups/{diskuse,openlist,freedisk}

If ~/backups/freemem/backups doesn't exist yet, then neither will work. You need mkdir -p instead to create missing directories in the hierarchy.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.