[英]Creating multiple directories in 3 directories Ubuntu
I have created 3 folders named Paul, James & Kurt. 我创建了3个名为Paul,James和Kurt的文件夹。
In each folder that I've created I must also have 3 folders named (Documents, Pictures, Music). 在我创建的每个文件夹中,我还必须有3个名为(文档,图片,音乐)的文件夹。
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 可以请我指导一下
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. 下面将为
users.txt
所有行创建新目录,并为每个Documents
一个子目录Documents
一个README
Documents
,其中包含上述内容。 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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.