LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Closed Thread
  Search this Thread
Old 01-15-2012, 08:32 PM   #1
calicowboy54
LQ Newbie
 
Registered: Jan 2012
Location: Huntington beach CA
Distribution: RH, CentOS
Posts: 6

Rep: Reputation: Disabled
need command to move folders older than 4 days to a bad up directory


I have several folders below in a directory that i need to have moved to a backup nas based on there older date....


20111225
20111226
20111227
20111228
20111229
20111230
20111231
20120101


i need to move above directories and all sub content to folder

back_up_data

can someone help me with command that i will put in to a script to cron this out...
 
Old 01-15-2012, 08:52 PM   #2
calicowboy54
LQ Newbie
 
Registered: Jan 2012
Location: Huntington beach CA
Distribution: RH, CentOS
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by calicowboy54 View Post
I have several folders below in a directory that i need to have moved to a backup nas based on there older date....


/var/logfiles/

20111225
20111226
20111227
20111228
20111229
20111230
20111231
20120101


i need to move above directories and all sub content to folder

back_up_data


can someone help me with command that i will put in to a script to cron this out...




Sorry i need to be more specific...

i need to Script this out where there are about 50files in Directory /var/logfiles/

they are stored in directories named like this

20111228

I need to move all the folders in that directory that are older than 5 days to another directory called /usr/nas_share_link/archvies

this is due to limited space on the /var/ directory so i need to move stuff off as new folders are being created with data inside them......

thanks
 
Old 01-15-2012, 09:04 PM   #3
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Member response

Hi,

Welcome to LQ!

What have you done to find a solution to the problem? Other than to post here.

We will aid you when you help yourself to a solution. Provide us with what you have attempted and then maybe someone will be able to assist.




May I suggest that you look at these links to aid you to gaining some understanding. Sure some may seem beyond a newbie but you must start somewhere;



Linux Documentation Project
Rute Tutorial & Exposition
Linux Command Guide
Utimate Linux Newbie Guide
LinuxSelfHelp
Bash Beginners Guide
Bash Reference Manual
Advanced Bash-Scripting Guide
Linux Home Networking



The above links and others can be found at 'Slackware-Links'. More than just SlackwareŽ links!
 
Old 01-15-2012, 09:23 PM   #4
djlewis78
LQ Newbie
 
Registered: Mar 2008
Location: Aucklnad
Distribution: Debian
Posts: 3

Rep: Reputation: 0
can you not just use

find /var/logfiles/ -ctime +5 -exec mv '{}' /usr/nas_share_link/archvies \;

havent tested it but is should be close to working.
 
Old 01-15-2012, 09:24 PM   #5
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Moderator response

Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place.

This thread is being closed because it is a duplicate of http://www.linuxquestions.org/questi...ectory-923951/

Please read the LQ Rules.
 
  


Closed Thread



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Move Folders Older than X, excluding one folder firegs Linux - General 4 06-02-2011 02:47 PM
Shell script to copy all folders older than 7 days from Linux to Windows by samba blackthu80 Linux - General 4 03-17-2011 12:29 AM
script to compress a directory and then delete older than 7 days replica88 Linux - General 3 02-03-2010 07:21 PM
removing directory having file older than 4 days irfanb146 Linux - Newbie 4 05-08-2008 11:05 AM
How to move files older than 30 days gfem AIX 8 11-08-2006 04:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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