duplicate a folder/file structure using a placeholder file I have a large library of digital media. Most of it is kept "offline" but the library software I use (Plex) uses media files to build the library and so I need to use placeholder files.

Using 30 second "this file is archived" videos I can easily catalog offline movies in Plex. I "rsync" the directory structure without files and then "do cp" a placeholder into each movie directory and rename using the parent folder name.

For TV shows this isn't practical as there can be hundreds of episodes per show. I would like to know if there is a way to duplicate the folder/file structure of a tv show, with many episodes under a single folder, using the same placeholder file.

I think there is a way to create folders from the filenames, then copy the placeholder into each new folder, rename using the folder name and then move the files back out to a single directory, but I don't know how.
Here is what I would do (there may be more efficient ways to automate this, but this is a quick hack that should achieve what you need). I hope I've understood your question correctly.

To get a list of all the directories (and their subdirectories) within an existing directory:

Open Terminal, and navigate to the existing folder containing the structure you would like to duplicate (if you are not familiar with Terminal, I am happy to give more specific guidance on how to do this. Basically, if you think of Terminal like Finder, the default folder that you are "viewing" when you open Terminal is your user folder. From there, you can type pwd to see where you are, ls to see a list of everything in the current directory, cd [folder name] to move into a folder in the directory, and then cd .. to move back up a level to the parent directory).

Type the following command:

find . -type d


This will list all of the directories contained in the current directory, as well as each of their subdirectories (i.e. it will not stop searching until there are no more subdirectories to enter).

The list will have entries that look something like this:

./directory1
./directory1/subdirectory1
./directory2
./directory2/sub2/sub3/sub4


We need to clean the formatting up just a bit before we can use this text.

To clean up the text so it can be used to recreate that folder structure:

Copy this list into any plain text editor (not Microsoft Word); I use TextWrangler but TextEdit comes with your computer. Using the find and replace feature, remove every instance of ./ (leave the "replace with" box empty and press replace all). This will delete all the initial periods and slashes, but retain subsequent slashes which indicate subdirectories.

Also, delete all new lines (i.e. the text may wrap onto multiple lines, but there should be no explicit new paragraphs in there). The above example will now look like:

directory1 directory1/subdirectory1 directory2 directory2/sub2/sub3/sub4


To create an arbitrary number of new folders with one command:

Note: You could also do this step using folder names from a different source, I was slightly confused by what the source of the folder names was in your question

You should now have a list of folder/subfolders that is all on one line (though it may wrap to multiple lines when it is rendered in your text editor), and has no punctuation*. Copy all of this text to your clipboard. Go back to Terminal, and use cd [folder], cd .., ls and pwd to navigate to the destination folder where you want to recreate the folder structure, as described above.

Once you are in the right folder, type:

mkdir -p and then commandv, and hit enter. Make sure there is a space (and nothing else) between mkdir -p and the first directory name, and one space between each subsequent directory name.

I know people have varying levels of familiarity with UNIX and the Terminal environment, so if this is confusing feel free to comment which steps need more clarification.

*Note that if any of the directory names you paste into Terminal have spaces or non alphanumeric characters such as (./'!?:_) etc., you need to escape them or it will not work. That is, for every space or other weird character, you must put a \ directly before it (note the difference between \ and /). So music/the beatles becomes music/the\ beatles. You can use find and replace for this as well.