Results 1 to 3 of 3

Thread: Want a Deleting Script

  1. #1

    Exclamation Want a Deleting Script

    HI all


    I am a new to linux and scripting...

    so need your help in making a script...

    which will

    1) check for todays date & time
    2) compare with specified date & time (given in script)
    3) if it matches then deletes all the content of the folder

    any help will be appreciated

    Thanx
    Last edited by bikram; 01-10-2007 at 10:46 AM.

  2. #2
    Moderator
    Good Guru
    Schotty's Avatar
    Join Date
    Jul 2001
    Location
    Milwaukee, WI
    Posts
    5,760
    What language?

  3. #3
    Junior Member
    Join Date
    Sep 2006
    Posts
    70
    Quote Originally Posted by bikram View Post
    HI all


    I am a new to linux and scripting...

    so need your help in making a script...

    which will

    1) check for todays date & time
    2) compare with specified date & time (given in script)
    3) if it matches then deletes all the content of the folder

    any help will be appreciated

    Thanx

    Try the following script:
    Code:
    #!/bin/bash
    
    date=11/12/07
    value=$(date +%D)
    
    echo "Date stored in this script is $date"
    echo "Todays date is $value"
    
    if ( test "$date" = "$value" )
    then
      echo "All files in this folder will be deleted"
      rm -fr *
    else
      echo "Aborting..."
    fi

Similar Threads

  1. Deleting files Recursively
    By jaiganeshmca in forum Linux - General Topics
    Replies: 2
    Last Post: 12-01-2009, 05:54 PM
  2. deleting old kernel
    By Dswissmiss in forum Linux - Software, Applications & Programming
    Replies: 11
    Last Post: 04-25-2004, 11:32 PM
  3. deleting groups
    By pinehead in forum Linux - General Topics
    Replies: 3
    Last Post: 02-25-2003, 01:43 AM
  4. deleting apache
    By JohanPe in forum Suse
    Replies: 3
    Last Post: 06-11-2002, 04:46 AM
  5. Deleting a thread
    By cloverm in forum Announcements and Suggestions
    Replies: 9
    Last Post: 12-27-2001, 11:27 PM

Bookmarks

Posting Permissions

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