LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris and OpenSolaris.
General Sun, SunOS and Sparc related questions also go here.

Notices

Reply
 
Search this Thread
Old 06-02-2006, 08:56 AM   #1
mustang05
LQ Newbie
 
Registered: Dec 2003
Posts: 26

Rep: Reputation: 15
Need to create a script to move files from one directory to another


I am running Sun OS 5.8, OpenWindows 6.4.1 on a Sun Sparc Ultra station. The script I'm trying to create involves moving files that are more then thirty days old from one directory to another on acoording to a set time scedule. What shell commands would i need to try to get this to work?
 
Old 06-02-2006, 10:04 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,369
Blog Entries: 54

Rep: Reputation: 2869Reputation: 2869Reputation: 2869Reputation: 2869Reputation: 2869Reputation: 2869Reputation: 2869Reputation: 2869Reputation: 2869Reputation: 2869Reputation: 2869
find, mv and crontab.
 
Old 06-02-2006, 10:40 AM   #3
mustang05
LQ Newbie
 
Registered: Dec 2003
Posts: 26

Original Poster
Rep: Reputation: 15
I already know those commands, I needed to know the rest of the path of the command for lets say a dir called 555555 that I was trying to move.
 
Old 06-02-2006, 11:11 AM   #4
Blinker_Fluid
Member
 
Registered: Jul 2003
Location: Clinging to my guns and religion.
Posts: 682

Rep: Reputation: 63
Something like this?

#to show you what you would actually move (doesn't do anything)
find /path/to/directory -ctime +30 -exec ls -l {} \;

#to actually move the files
find /path/to/directory -ctime +30 -exec mv {} /path/to/new/directory \:
 
Old 06-16-2006, 10:25 AM   #5
spyghost
Member
 
Registered: Jun 2003
Distribution: Redhat
Posts: 245

Rep: Reputation: 30
Quote:
Originally Posted by Blinker_Fluid
Something like this?

#to show you what you would actually move (doesn't do anything)
find /path/to/directory -ctime +30 -exec ls -l {} \;

#to actually move the files
find /path/to/directory -ctime +30 -exec mv {} /path/to/new/directory \:
just add these to crontab and make sure you have rw access in the source and desitnation directories
 
  


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
loop move files up one directory level Melsync Programming 8 12-19-2005 10:51 PM
how to write a script to move files from one directory to another myeire Linux - Newbie 7 02-25-2005 10:01 AM
denied access to move files into /usr/src directory Larry O Linux - Newbie 4 01-17-2005 11:14 PM
Does anyone know how to move files to a particular directory using shell scripting RowanB Programming 3 11-11-2004 01:46 PM
Script to Move files jain_rajesh Linux - Newbie 1 10-15-2004 08:53 AM


All times are GMT -5. The time now is 07:43 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration