Tuesday, November 23, 2010

Creating files for testing - part 2

To test the behaviour of one of our applications, I needed to create a certain number of files of a certain file format. To do this, I wanted to copy the source file (a bitmap) multiple times and have the result go to the same directory. So the files did not overwrite each other, I needed to increment the file name (like: 0file.bmp, 1file.bmp, 2file.bmp).

With some help from one of the developers, I came up with a script that can also create a specified number of text files (file1.txt, file2.txt etc.)

The script takes two inputs:
  • number of files to create - mandatory
  • file to copy - optional

If a file to copy is not specified, the script will create as many text files as the mandatory number entered.

I've published the script on our team's repository on GitHub. You can find it here:


1 comment:

  1. Once again great post. You seem to have a good understanding of these themes.When I entering your blog,I felt this . Come on and keep writting your blog will be more attractive. To Your Success!
    Flower Girl Dresses|Empire Wedding Dresses|New Style Wedding Dresses