LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-14-2009, 05:26 AM   #1
dave7802
LQ Newbie
 
Registered: Sep 2009
Posts: 1

Rep: Reputation: 0
Delete files in folder before todays date


Hello all,
New here and a nice place you have here,

i have a quick question i am use one of you wizzy guys can help me with

I currently have a command to backup a directory it will zip the directory
and place it where i have told it too,

Now what i am after is a command i can run before my code,
that will delete and tar.gz files before todays date
so i my ideal world

it would be something like this,

delete <'date +%m_%d_%y'.tar so this will delete all the files in this folder before todays date,

this make sence....

thanks in advance if anyone is able to help me :-)
 
Old 09-14-2009, 06:03 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
find -daystart -ctime +0 -exec rm -f {} \;


should do it.
 
  


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
Delete files based on current date -1 Winanjaya Linux - Newbie 3 06-23-2008 05:38 AM
Uploading all files with todays date via kermit isourcemarketing Programming 2 08-26-2007 09:27 PM
delete files by date noir911 Programming 4 10-04-2006 08:42 AM
Delete files based on date stefaandk Linux - General 3 06-17-2005 03:20 AM
delete files date wise hardeep_ubhi Linux - General 1 11-16-2004 03:07 AM


All times are GMT -5. The time now is 05:16 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration