May 2013
Beginner to intermediate
384 pages
7h 40m
English
Sometimes we may need to generate test cases to test programs that operate on thousands of files. Let's discuss how to generate such files in this recipe.
touch is a command that can create blank files or modify the timestamp of files if they already exist. Let's take a look at how to use them.
filename will be created using the following command:
$ touch filename
for name in {1..100}.txt
do
touch $name
doneIn the preceding code {1..100} will be expanded as a string "1, 2, 3, 4, 5, 6, 7...100". Instead of {1..100}.txt, we can use various shorthand patterns such as test{1..200}.c, test{a..z}.txt, and so ...
Read now
Unlock full access