LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-15-2003, 02:39 PM   #1
meluser
Member
 
Registered: Mar 2003
Posts: 65

Rep: Reputation: 15
deleting images after a week


hi,

i am trying to develop a script that deletes images after a week of being stored on the computer.

i have a script that takes images from a camera when movement occurs, and then renames images with the date and time, and finally stores the images meta information inside a database.

what i would like is a script that would deleted the images that are more than 1 week old, lets say.

any help appreciated,


cheers,
Mel
 
Old 07-15-2003, 02:45 PM   #2
jpbarto
Senior Member
 
Registered: Mar 2003
Location: Pittsburgh, PA
Distribution: Gentoo / NetBSD
Posts: 1,251

Rep: Reputation: 45
you can use the 'find' utility to provide a listing of files that have a modified date older than a week and then feed those filenames to an 'rm' command.

hope that helps,
jpbarto
 
Old 07-15-2003, 04:17 PM   #3
the.jxc
LQ Newbie
 
Registered: Jun 2003
Posts: 14

Rep: Reputation: 0
To be specific:

If your files are in directory /tmp/images, then your find command will be something like...

find /tmp/images -type f -mtime +4 -exec rm {} \; -print

This tells find to look in /tmp/images for files which are more than 4 days old. For each such file, it executes the "rm" command, with the matching file substituted for {}. The backslash-semicolon is required as the end of the command to execute. The -print flag tells it to print the name of all the matching files, you can omit that if you want, but it;s good for when you're testing.
 
  


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
Convert cd images to dvd images rcsuk Debian 2 07-11-2005 10:34 AM
The joke of the week. (Or, maybe, the year?) z-vet General 15 12-04-2004 08:05 PM
About to give up [been trying for a week] evrae Linux - Software 23 06-25-2004 03:29 PM
Why Mandrake Slows Down Every Week Crito Mandriva 0 03-14-2004 02:17 PM
Week 1 Complete. At0mic_PC Slackware 4 08-03-2003 03:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:30 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