LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 01-22-2010, 01:10 AM   #1
ericczed
LQ Newbie
 
Registered: Jan 2010
Posts: 2

Rep: Reputation: 0
I need a script that will move all 30 days old files in a folder


Hi,

I`m totally new to linux, in fact I`m a windows admin. I would appreciate any help.

scenario:

I need to run a script that will automatically move 30 days old files from particular folder to a particular folder.

Please help...my boss is pressuring me............

regards,

eric

Last edited by ericczed; 01-22-2010 at 01:11 AM.
 
Old 01-22-2010, 01:57 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,348

Rep: Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749
You'll need the find cmd
Code:
find /Dir1 -type f -mtime +30 -exec mv {} Dir2 \;
Note that find re-curses downwards in Dir1 (src dir); if you don't want sub-dirs checked, use -maxdepth 0
eg
Code:
find /Dir1 -type f -maxdepth 0 -mtime +30 -exec mv {} Dir2 \;
See the man page for 'find' : http://linux.die.net/man/1/find

Test first ...
 
Old 01-23-2010, 08:05 AM   #3
cola
Senior Member
 
Registered: Sep 2007
Posts: 1,035

Rep: Reputation: 65
Quote:
Originally Posted by ericczed View Post
Hi,

I`m totally new to linux, in fact I`m a windows admin. I would appreciate any help.

scenario:

I need to run a script that will automatically move 30 days old files from particular folder to a particular folder.

Please help...my boss is pressuring me............

regards,

eric
Mark the thread as "[SOLVED]".This option is under the "Thread Tools" above.

It's urgent or this is not encouraged in LQ.
Code:
Please help...my boss is pressuring me............
 
Old 01-23-2010, 08:31 AM   #4
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,922
Blog Entries: 44

Rep: Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158
Hi,

Welcome to LQ!

Quote:
Originally Posted by ericczed View Post
Hi,

I`m totally new to linux, in fact I`m a windows admin. I would appreciate any help.

scenario:

I need to run a script that will automatically move 30 days old files from particular folder to a particular folder.

Please help...my boss is pressuring me............

regards,

eric
Since you have been given a solution then mark the thread via the 'Thread Tools'.

Just a few links to aid yourself in the future;

Linux Documentation Project
Rute Tutorial & Exposition
Linux Command Guide
Utimate Linux Newbie Guide
LinuxSelfHelp
Getting Started with Linux
Advanced Bash-Scripting Guide
Linux Home Networking


The above links and others can be found at 'Slackware-Links'. More than just SlackwareŽ links!
 
  


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
[SOLVED] Bash script needed to move files to another folder. No_one_knows_me Linux - General 28 01-07-2010 10:29 PM
Automated script to DELETE files older than 2 days in a Particular folder siddhartha_ece2004 Linux - Newbie 14 07-11-2008 05:46 AM
How to move files older than 30 days gfem AIX 8 11-08-2006 04:58 AM
How to automatically move files from one folder into another folder? xmrkite Linux - Software 6 11-05-2006 10:39 AM
making a script that will move a file or files in a trash folder Paxmaster Programming 5 12-12-2004 06:00 PM

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

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