Creating directory structures in Terminal

Before photographing, imaging, or otherwise documenting any digital media, you will need to generate folders to house the files generated by processing activities. You will need to create one top-level directory for each piece of media to be processed, and two sub-directories. **One piece of media will correspond to one AIP.

AIPidentifier_mediaNumber (folder)

            AIPidentifier_mediaNumber_diskimage (folder)

            AIPidentifier_mediaNumber_media_photographs (folder)

            AIPidentifier_mediaNumber_readme (optional – text file)

Ex:

Directory for image file and documentation of floppy disk #1


2017009_01_001

            2017009_01_001_diskimage

                        2017009_01_001_diskimage.E01

                        2017009_01_001_diskimage.log

            2017009_01_001_photographs

                        2017009_01_001_01.jpg

                        2017009_01_001_02.jpg

            2017009_01_001_readme.txt

Step-by-step guide


  • Start MS Excel application

  • In the first column of your spreadsheet, type in “mkdir” (the “make directory” command)

  • You will need to decide whether you’ll be creating a local staging folder and what that folder will be named. For this collection, I initially created a desktop folder with the accession number as its title (2017009). N.b., when working in Terminal, you will need to “cd” to the correct folder location, otherwise the directories you create will all be output to your “home” (user) directory. If you want your staging folder on your desktop, just type in “cd Desktop” at the command prompt and hit “return” to execute. 

  • In the second column of your spreadsheet, type in the name of your staging folder (e.g., 2017009)

  • In the third column, type in the first AIP folder title as your starting value (e.g., 2017009_01_001), then enter the second AIP folder title just below it to establish a pattern. Highlight both cells and hover the mouse over the lower right-hand corner of the bottom cell, then drag your mouse downward to auto-fill as many cells as needed. Repeat for different media groups (i.e., repeat with starting value of 2017009_02_001, etc.). Note that for every row, the mkdir command must be followed by the entire file path. Below I’ve included a sample of what the spreadsheet should look like at this point:

  • Once every top-level (AIP) folder has been created, you’ll next want to create your sub-directories. Copy and paste all the values into a new tab in your spreadsheet. In the next (fourth) column, type in “_diskimage,” hover over the lower right-hand corner of the cell and drag down to auto-fill the necessary cells.

  • To concatenate the values from the third and fourth columns to create the correct folder name, e.g., 2017009_01_001_diskimage, type the following formula into the first cell of the fifth column: “=(C1&””&D1)” [change column letter if necessary]. Again, drag formula down to increment/auto-fill.


  • Now that the correct values have been generated, you’ll want to replace the _diskimage column. Since the values were created using a formula, be careful not to alter them by simply deleting column D. First, copy the new set of values, then navigate to the Edit tab and select “Paste special” (^++V), make sure “Values” is selected and hit “OK.” Then proceed to delete column D.

  • Repeat procedure for “_media_photographs” sub-directories.


Using Terminal:

  • Change directory to the desktop by entering command: cd desktop 

  • On the desktop create a folder with the highest level directory name. 

  • Copy and paste the values for the subdirectories on the command line. 


  • The new directories will be created in the folder on the desktop. 


  • Do the same for each subdirectory.