Find the answer to your Linux question:
Results 1 to 6 of 6
hi all, hw to delete old files in a diretory (ex: log dir)which is growing, based on their access times...can anyone help me with guidelines to write a C program ...
  1. #1
    Just Joined!
    Join Date
    Jan 2007
    Posts
    23

    removing old files from a directory based on their access times...

    hi all,

    hw to delete old files in a diretory (ex: log dir)which is growing, based on their access times...can anyone help me with guidelines to write a C program for this..

    Thanks in advance..

  2. #2
    Linux Enthusiast likwid's Avatar
    Join Date
    Dec 2006
    Location
    MA
    Posts
    649
    I think a shell script would be better suited for this...

  3. #3
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,568

    Smile

    You can uses stat() system call and unlink() system call and easily do this in C.
    - Lakshmipathi.G
    -------------------
    FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
    First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -------------------

  4. #4
    Just Joined!
    Join Date
    Jan 2007
    Posts
    23

    deleting old files based on their access time

    hi lakshmipati garu,

    thanx for ur suggestions.. i had applied the stat() system call and unlink system calls...

    -elitecore

  5. #5
    Just Joined!
    Join Date
    Jan 2007
    Posts
    23

    deleting old files based on their access time

    hi likwid,

    yeah....u r right, shell script is the best solution...but i have to implement it using C.....thanx for ur reply.....

    --elitecore

  6. #6
    Linux Enthusiast likwid's Avatar
    Join Date
    Dec 2006
    Location
    MA
    Posts
    649
    I smell homework...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...