Link to home
Start Free TrialLog in
Avatar of sventhan
sventhanFlag for United States of America

asked on

How to create dummy files in UNIX?

hello experts -

How to create the dummy files for last 6 months in UNIX?
I need these dummy files for testing a archiving script that we have.

Any ideas?
ASKER CERTIFIED SOLUTION
Avatar of flow01
flow01
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sventhan

ASKER

Thanks flow@.
The key here is the timestamp. The archiving script will be looking for this unix system timestamp as a key to archive the files which are older then 180 days.
 
 
Thanks.

found a soultion by myself.
The proposed solution above will create files with the current timestamp.

To create files with a certain timestamp you should have been using

touch -t [[CC]YY]MMDDhhmm[.SS] filename

with
 
CC - century e.g. '20'
YY - year e.g.'09'
MM - month e.g. '04'
DD - day e.g. '01'
hh - hour e.g.'00'
mm - minute e.g. '00'
SS - second e.g. '00'

So touch -t 200904010000 filename will create a file of name filename older than 6 months, i.e. from  April, 1st 2009

Always glad to help,

wmp

Thanks wmp for the wonderful answer.  Good luck to you.