LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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, 07: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, 08:47 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,622

Rep: Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964
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, 08: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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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