Vim Tips Wiki

Creating directories from a list

1,624pages on
this wiki
Add New Page
Talk0 Share

You may need to create directories from a text file wherein each line defines a category from which a directory should be created.

So here is the command to use :

%g/\<\w\+\>/ y A | exe ' !mkdir '. shellescape(substitute(substitute(@a, '\n\+\s*', '', ''), '\s*\n\+', '', '')) | let @a =""

and the silent version :

%g/\<\w\+\>/ y A | exe 'silent !mkdir '. shellescape(substitute(substitute(@a, '\n\+\s*', '', ''), '\s*\n\+', '', '')) | let @a =""


This is not much use without a short example and a reason why Vim should be used to create directories. Why not edit a script to do the work and run it from the shell? JohnBeckett (talk) 00:00, June 6, 2016 (UTC)

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random Wiki