jdspringr07
jdspringr07

Reputation: 19

Make multiple directories and put files into each one

I've been attempting to mkdir multiple directories and the touch a set of files into each one.

I'm basically trying to combine the following:

mkdir ./file_directory{1..10};

then in each directory

touch ./file_directory{1..2} file_name{1..10};

When I execute touch it creates a the file_name{1..10} under ./

I've been looking around. Please forgive me for I have sinned and am new to not only bash, but coding/scripting in general. I'm attempting to create these files to learn scripting. Although this is technically my first project, I'm going to

Upvotes: 1

Views: 74

Answers (1)

Barmar
Barmar

Reputation: 780889

You need to put / between the directory and filename to create a file in the subdirectory:

mkdir file_directory{1..10}
touch file_directory{1..10}/file_name{1..10}

Upvotes: 3

Related Questions