|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
Hello all.
This is my first post here. I'm not an unix guy so please bear with me. At work, from time to time I get the need to have some 'junk' files of varying sizes. Typically, I write a small 'script' which cats a file to another file. I run this manually until it reaches closer to a desired size. My question: Is there a better way to create a file which comes to the exact size as specified. Please give me pointers. I have to write this in Aix environment. Thanks a lot in advance! |
|
#2
|
|||
|
|||
|
q1: what's a junk file ?
q2: 4 what you need a junk file ? q3: did you try: man mkfile ? |
|
#3
|
|||
|
|||
|
Yes and no. What you are doing is fairly common for pure
shell script programming. A more efficient way is to write a small C program to create a file of the exact size that you want i.e. mkemptyfile <filename> <size> Another way is to use /dev/zero in conjunction with the dd utility i..e. dd if=/dev/zero of=filename bs=1024 count=20 creates the zeroized file "filename" of size 20K. Last edited by fpmurphy : September 29th, 2004 at 07:55 PM. |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > create file for a desired file size. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|