Find the answer to your Linux question:
Results 1 to 5 of 5
I have a quick question. I'm just getting back into unix so my command line is weak. How can I delete say all my folders from 2008? Or delete a ...
  1. #1
    Just Joined! DaWoo's Avatar
    Join Date
    Feb 2009
    Location
    Jersey
    Posts
    16

    deleting old data

    I have a quick question. I'm just getting back into unix so my command line is weak.
    How can I delete say all my folders from 2008?
    Or delete a certain month worth of folders? say Jan 2009.

  2. #2
    Linux Guru gogalthorp's Avatar
    Join Date
    Oct 2006
    Location
    West (by God) Virginia
    Posts
    3,105
    rm is the remove command use
    man rm

    to get all the options

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

    Smile

    Please Refer this thread - it should help you to learn about it ( i guess you can ignore the name option which is specified below and change the mtime option to specific time period)

    http://www.linuxforums.org/forum/red...t-exec-rm.html


    HTH
    - 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! DaWoo's Avatar
    Join Date
    Feb 2009
    Location
    Jersey
    Posts
    16
    Thank you Lakshmipathi. That's exactly what I needed. My drive was filling up and I needed to get rid of the old files. I actually found my answer about 10 minutes after I posted this thread last night.

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

    Exclamation

    Today i came to know about this solution:

    To delete all files after specific date (say : 2009/05/18 12:00 pm)
    first create a file.


    touch -t 200905181200 test
    then use it with find command

    find /var/log/ -type f -newer test -exec rm {} \;
    Hope this helps someone
    - 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
    -------------------

Posting Permissions

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