Create a tar file of desired size

August 31, 2010 at 16:54:33
Specs: Windows XP
Hi,
Is there a way to create a tar file of a required size? I need to have a tar file of fixed size like 330MB,500MB and so on. How much should the size of the directory be in order to get the tar file of these sizes?

See More: Create a tar file of desired size

Report •

#1
September 1, 2010 at 11:02:23
Unless compressed, the tar file will be the same size as the sum of its contents. I'm not sure why you need something with an exact file size, but if you're just looking to test something, you could try something like:

dd if=/dev/zero of=test bs=500MB count=1
tar -cvf test.tar test

That basically makes a blank file of a specified size and then puts it in a tarball.


Report •

#2
September 2, 2010 at 15:59:05
Ok Thanks. I am required to test a feature using these fixed tar file sizes. Will try this out.

Report •
Related Solutions


Ask Question