Quickly create some test files

I was wanting to test some things recently, this is a quick way I create many files in a directory.

This is how I do it in bash

for files in {1..10}
touch $files

Or another way in bash

touch {1..10}.txt

Another example using Python this time

for i in range(1, 101):

If you had a list of names, or countries etc, this perl one liner will create all the files based on each line of the file

perl -ne 'chomp; `touch $_`;' filename.txt

I am always interested in feedback so please feel free to add any comments, or you can mail me  here.  If you would like to submit a quick tip  with full credit and links back to your site then also feel free to contact me.

Related Posts Plugin for WordPress, Blogger...

Remove Extension from files in bash

Add a link inside a document within Evernote