0

I have created 3 folders named Paul, James & Kurt.

In each folder that I've created I must also have 3 folders named (Documents, Pictures, Music).

And also

Each named folder should have a README file containing the following contents: "These folders are used to store employee details."

Can some kindly guide me through this

3
  • Do you need help in creating files in all those directories? I didn't follow up your question, would you provide more info? Commented Apr 1, 2017 at 14:27
  • You know how to create folder (or directories), so creating Documents etc. should be doable. echo "These folders are used to store employee details." > README will create your file. Commented Apr 1, 2017 at 14:33
  • #!/bin/bash for names in $(cat "users.txt"); do mkdir "$names" done .............I used this bash script and I want to add the creation of a text file in the folders to it Commented Apr 1, 2017 at 15:17

1 Answer 1

1

The below will create new directories for all lines in users.txt and a sub-directory in each for Documents with a README in it with the above contents. Hope it helps.

Sub=Documents
for names in $(cat "users.txt"); do
    mkdir -p "$names"/{"$Sub",} && touch "$names"/"$Sub"/README.txt && 
echo "These folders are used to store employee details." > "$names"/"$Sub"/README.txt
done
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.