LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 03-20-2005, 06:56 AM   #1
wrongman
Member
 
Registered: May 2004
Location: Italy
Distribution: Debian Unstable 64bit
Posts: 99

Rep: Reputation: 15
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
 
Old 03-20-2005, 07:09 AM   #2
carboncopy
Senior Member
 
Registered: Jan 2003
Location: Malaysia
Distribution: Fedora Core, Slackware, Mac OS X, Debian, OpenSUSE
Posts: 1,210
Blog Entries: 4

Rep: Reputation: 45
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.
 
Old 03-20-2005, 07:12 AM   #3
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371
Hi,

You could use dd (man dd for details).

Example:

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.
 
Old 03-20-2005, 12:12 PM   #4
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 51
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);
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Faking the name of a cd brainlesspinkey Linux - Software 5 07-29-2004 03:12 PM
IP address faking Vaish Linux - Networking 8 05-17-2004 12:25 PM
faking HWaddr and inetaddr Hano Linux - Networking 3 11-05-2003 01:12 PM
How to play a media file/ video file/mp3 file recorded in harddisk/cd-rom arindam Linux - Newbie 2 09-05-2003 10:31 AM
faking /dev/dsp? tristan_vdv Linux - General 3 05-03-2002 04:18 AM


All times are GMT -5. The time now is 01:53 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration