LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-12-2003, 08:36 AM   #1
dragon49
LQ Newbie
 
Registered: Feb 2003
Distribution: Caldera Open Linux 3.1
Posts: 3

Rep: Reputation: 0
Shell Script Syntax


I need to write a shell script that will run at the beginning of a new day. Depending on a few factors, it will run between 12:00 A.M. and 12:03 A.M. I have the script written, except for the last line. I need to delete all files that were not created on today's date. I tried this line:

find ./ -type f -mtime +0 -mtime -2 -exec ls -l {} \; -exec rm -v {} \;

This deletes all files that were created more than 24 hours ago.

I want to delete all files in the directory that were created prior to 12:00 A.M. What is the syntax to accomplish this?


Thank you
 
Old 03-12-2003, 09:25 AM   #2
moses
Senior Member
 
Registered: Sep 2002
Location: Arizona, US, Earth
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152

Rep: Reputation: 50
Read the find manpage. It's there, I promise. =-}
Look for daystart.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script problem, want to use shell script auto update IP~! singying304 Programming 4 11-29-2005 05:32 PM
shell script help required syntax error sridhar11 Programming 1 10-31-2005 08:38 AM
shell color syntax/highlighting on FC4 kz26 Linux - General 18 08-16-2005 10:07 PM
Shell Command Syntax swan2925 Linux - Software 3 06-02-2005 10:07 AM
Shell function syntax error... psyklops Programming 1 09-03-2003 01:55 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:15 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
Open Source Consulting | Domain Registration