Creating multiples directories from a file on bash terminal

The problem

A repetitive task to do: create 111 directories with 2 sub directories each one. The structure is:

├── SMD0088
│   ├── files
│   └── tasks

The names are from a spreadsheet column.

The motivation

I need to pre…


This content originally appeared on DEV Community and was authored by Emanoel Lopes

The problem

A repetitive task to do: create 111 directories with 2 sub directories each one. The structure is:

├── SMD0088
│   ├── files
│   └── tasks

The names are from a spreadsheet column.

The motivation

I need to prepare 6 computer labs for next semester classes. Each professor has a small list of application to install on a right lab.

The Solution

Create an Ansible role to each subject and a playbook for each lab.

The procedure

  1. Copy and paste the spreadsheet column and save as 'd' file.
  2. Navigate to 'playbook/roles' ansible directory and run the command:

$ while read line; do mkdir -p $line/{tasks,files}; done < d

The result

The line 'SMD0088' on "d" turns on to 'SMD0088/files' and 'SMD0088/tasks' directories.


This content originally appeared on DEV Community and was authored by Emanoel Lopes


Print Share Comment Cite Upload Translate Updates
APA

Emanoel Lopes | Sciencx (2022-06-13T19:56:25+00:00) Creating multiples directories from a file on bash terminal. Retrieved from https://www.scien.cx/2022/06/13/creating-multiples-directories-from-a-file-on-bash-terminal/

MLA
" » Creating multiples directories from a file on bash terminal." Emanoel Lopes | Sciencx - Monday June 13, 2022, https://www.scien.cx/2022/06/13/creating-multiples-directories-from-a-file-on-bash-terminal/
HARVARD
Emanoel Lopes | Sciencx Monday June 13, 2022 » Creating multiples directories from a file on bash terminal., viewed ,<https://www.scien.cx/2022/06/13/creating-multiples-directories-from-a-file-on-bash-terminal/>
VANCOUVER
Emanoel Lopes | Sciencx - » Creating multiples directories from a file on bash terminal. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/06/13/creating-multiples-directories-from-a-file-on-bash-terminal/
CHICAGO
" » Creating multiples directories from a file on bash terminal." Emanoel Lopes | Sciencx - Accessed . https://www.scien.cx/2022/06/13/creating-multiples-directories-from-a-file-on-bash-terminal/
IEEE
" » Creating multiples directories from a file on bash terminal." Emanoel Lopes | Sciencx [Online]. Available: https://www.scien.cx/2022/06/13/creating-multiples-directories-from-a-file-on-bash-terminal/. [Accessed: ]
rf:citation
» Creating multiples directories from a file on bash terminal | Emanoel Lopes | Sciencx | https://www.scien.cx/2022/06/13/creating-multiples-directories-from-a-file-on-bash-terminal/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.