Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How to find and move the files based on time stamp in Linux system?

Posted on 2010-11-17
4
444 Views
Last Modified: 2012-05-10
This is SUSE Linux enterprise server 11.0. This is a folder, called WHETHER, used to collect latest info about the whether. Newer files would be updated anytime. To avoid the file and folder sizes outgrown, I'm thinking to move the files, that are more than 1 month old, to another backup folder - /backup/Whether. How should I do it to use a cron job?
0
Comment
Question by:Balack
  • 3
4 Comments
 
LVL 23

Expert Comment

by:savone
ID: 34161391
find /WHETHER -mtime +90 -exec mv '{}' /backup/Whether \;
0
 
LVL 23

Expert Comment

by:savone
ID: 34161395
sorry this is probably better:

find /WHETHER -type f -mtime +90 -exec mv '{}' /backup/Whether \;
0
 
LVL 23

Accepted Solution

by:
savone earned 500 total points
ID: 34161404
You can add it to cron like this:

crontab -e

then add this line:
# run five minutes after midnight, every day
5 0 * * * find /WHETHER -type f -mtime +90 -exec mv '{}' /backup/Whether \;

I am not sure where your WHETHER folder is, this assumes its at the root of the filesystem.  If its somewhere else you might want to change the \WHETHER to your path
0
 

Author Closing Comment

by:Balack
ID: 34264071
Good
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question