command 'touch "file{1..10}".txt' creates 10 files file1.txt, file2.txt .... etc. How can we also create multiple file with specific file size in this form.
what I tried:
fallocate -l 10M file{1..10}.txt
Output
fallocate: unexpected number of arguments
CodePudding user response:
According to the manual page, fallocate
expects a single file name only.
You can use a loop:
for f in file{1..10}.txt
do
fallocate -l 10M "$f"
done
or as a single line
for f in file{1..10}.txt; do fallocate -l 10M "$f"; done
CodePudding user response:
You could use truncate
to extend the size of a file to a specific size
truncate -s 10M file{1..10}.txt