B4Print.com

Operating Systems => Macintosh => Topic started by: Slappy on December 04, 2019, 02:32:55 PM

Title: Rebuild Client Directory with Empty Folders
Post by: Slappy on December 04, 2019, 02:32:55 PM
Short Ask: is there an easy way to duplicate hundreds (or more) folders but JUST the names?

Long Explanation: We're expanding our server storage and have decided we'd like to start "clean" with the exact same folder structure. Looking for a way to duplicate all the existing top-level folder names so we dn't have to manually make them all again. I know I can Copy-Paste folder names into a text doc, but not sure how to them re-populate a server structure with all those names.
Title: Re: Rebuild Client Directory with Empty Folders
Post by: Joe on December 04, 2019, 03:25:00 PM
Have a read here:

Easily create lots of new folders (https://www.macworld.com/article/1057853/foldercreate.html)
Title: Re: Rebuild Client Directory with Empty Folders
Post by: Slappy on December 04, 2019, 08:41:36 PM
Innnnntersting! I'll try it locally with a selection of folder names/folders first. Thanks!
Title: Re: Rebuild Client Directory with Empty Folders
Post by: DigiCorn on December 05, 2019, 12:43:00 PM
I really only need like 5-6 for each client, but I set it all up the way I want it and have it on the desktop. Then I just drag it to the server when I need it.
Title: Re: Rebuild Client Directory with Empty Folders
Post by: Slappy on May 27, 2020, 01:22:55 PM
Finally got around to needing this, and having the time to try it out - works kind of as expected, with a few extra steps.

That link that describes using Terminal is the right way, but it needs the folder structure listing to be on a single line, with each Folder in quotes (to preserve spaces in the names) and a space between each quoted Folder Name. So...enter TextMechanic website! I've used it for some other basic functions (ie number lists with prefix/suffix characters) but it will do 2 necessary things for this project:

Add Prefix/Suffix into Line (https://textmechanic.com/text-tools/basic-text-tools/add-prefixsuffix-into-line/) - For the quotes before/after each folder name.

Add/Remove Line Breaks (https://textmechanic.com/text-tools/basic-text-tools/addremove-line-breaks/)- Puts everything onto ONE line, and adds the necessary space between each.

THEN I ran the aforementioned Terminal command (cat dirlist.txt | xargs mkdir) and BAM! instant Folders galore. Sexah.  :banana: :banana:
Title: Re: Rebuild Client Directory with Empty Folders
Post by: swampymarsh on February 06, 2021, 06:07:22 PM
Hi Slappy,

The textmechanic website has helped me more than once before. Although this is an old topic, I thought that it was worthwhile adding another option.

This is also possible via a regular expression find/replace (like GREP in InDesign), which only needs a single command.

Find:
(.+)(\n)

Replace:
'$1'

Note, there is a word space at the end of the replace text, which I have attempted to show with the underline.

Attached is a screenshot from the regex101 website (one of many regular expression sites out there).