LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-01-2004, 07:09 PM   #1
vrillusions
Member
 
Registered: Feb 2003
Location: Ohio, USA
Distribution: Ubuntu, Debian, CentOS
Posts: 99

Rep: Reputation: 25
Question show files past a certain date


I was hoping the man pages would help but there were no examples and searching for "find" comes up with a ton of info, that has no relation to this. I have a script that backs up the mysql database (using mysqldump) and then renaming it to the current date. I only want to keep the last 7 days. Right now the script just looks for a file with a date from 8 days ago and deletes it. The problem with this is if the computer locks up or something (which seti@home does every once and a while) that file may not get deleted. I was looking for a better way to do this. I thought I would be able to do this with the find command, but I couldn't figure it out. I can get it to show the past 7 days, but I want it to show the reverse of that, everything BUT the last 7 days. I am doing the 7 day thing by doing the following:

Code:
find -mtime -7
Also, I've always had problems with this on find, but what's the proper way to search for part of a file. If I try something like `find -name database*` where the file would be something like database_20031225.sql.gz it gives me an error that paths must precede expression.

this is all happening in mandrake 9.1 btw
 
Old 01-01-2004, 07:46 PM   #2
sharper
Member
 
Registered: Aug 2002
Location: MN USA
Distribution: slakware 9.0
Posts: 121

Rep: Reputation: 15
For find -mtime -7 try find -mtime +7.

Find wants a directory and if none is given the current one is used. Maybe try find ./ -name database*
 
Old 01-01-2004, 08:08 PM   #3
J_Szucs
Senior Member
 
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126

Rep: Reputation: 58
Quote the search string:
find ./ mtime +7 -name "database*"
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Time and Date on files Azhrarn Linux - Newbie 2 09-05-2005 04:32 AM
Anyway to get xclock to show just the date? Royle Linux - General 11 07-30-2005 11:17 AM
Copy files after a certain date davholla Linux - General 2 03-17-2005 09:29 AM
Need way to change the date of files BH_Exeter Linux - Software 7 08-26-2004 08:21 AM
show date in mysql bentman78 Linux - Software 0 05-17-2004 11:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:25 PM.

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
Open Source Consulting | Domain Registration