-   Linux - Software (
-   -   faking a file.. (

wrongman 03-20-2005 07:56 AM

faking a file..
how can i set a fake filesize in a file? with touch i can modify only the dates... or alternatively, if it isn't possible to fake filesize, how can i fill an empty file with X zeros to reach the size i need?
thanks a lot

carboncopy 03-20-2005 08:09 AM

I don't know, Azureus seems to be able to do that :)

Hmm, must be something to do with the filesystem.

Well, you can write a loop prog to cat 0 >> fake.file.

But that is not really fake since you are actually using up that amount of space on disk.

Just my 2 cents.

druuna 03-20-2005 08:12 AM


You could use dd (man dd for details).


dd if=/dev/zero of=outfile bs=1024 count=10
This creates tge following ('empty') file:

10240 Mar 20 14:10 outfile

Hope this helps.

foo_bar_foo 03-20-2005 01:12 PM

i don't know if this qualifies as faking it but you can adjust the size of a file with the POSIX syscall
int ftruncate(int fd,off_t length);

All times are GMT -5. The time now is 05:17 PM.