LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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-16-2013, 08:50 PM   #1
larrybg
Member
 
Registered: Aug 2013
Posts: 31

Rep: Reputation: Disabled
Question Script to delete files on schedule


Hi everyone,
Please help - I need a script that will run on schedule and delete folders and files from the NAS drive older than X days.

Thanks
 
Old 09-16-2013, 09:47 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,928

Rep: Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690
Quote:
Originally Posted by larrybg View Post
Hi everyone,
Please help - I need a script that will run on schedule and delete folders and files from the NAS drive older than X days.
Thanks
Ok..we'll be glad to help you, but we will NOT write your scripts for you. There are many easily-found bash scripting tutorials; start there. Post what you've written/tried, and tell us where you're stuck.

Otherwise, read the man page on the find command, and pay particular attention to the ctime/mtime parameters.
 
Old 09-16-2013, 09:59 PM   #3
J.A.X
Member
 
Registered: Jan 2010
Distribution: Fedora 19
Posts: 83

Rep: Reputation: 3
Hi there,

You may want to look at the man pages for cron.

Write a script to remove the X days old files, cron daemon will run the script for you at a specific time.

http://en.wikipedia.org/wiki/Cron

I hope this helped
 
  


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
Using Shell Script crontab backup and delete with schedule chamreth Linux - Newbie 7 10-28-2009 07:59 AM
Script help - delete files older than 45 days but exclude the system files jojothedogboy Linux - Software 3 06-13-2008 04:43 PM
Delete old files script simpi Linux - Newbie 11 04-25-2008 03:37 AM
How to write a script to delete files? AGazzaz Linux - General 11 12-05-2007 07:43 AM
Delete old files and folders Script? AsteX Linux - General 4 11-11-2004 07:26 PM


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