LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Solaris / OpenSolaris (https://www.linuxquestions.org/questions/solaris-opensolaris-20/)
-   -   Need to create a script to move files from one directory to another (https://www.linuxquestions.org/questions/solaris-opensolaris-20/need-to-create-a-script-to-move-files-from-one-directory-to-another-450902/)

mustang05 06-02-2006 09:56 AM

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?

unSpawn 06-02-2006 11:04 AM

find, mv and crontab.

mustang05 06-02-2006 11:40 AM

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.

Blinker_Fluid 06-02-2006 12:11 PM

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 \:

spyghost 06-16-2006 11:25 AM

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


All times are GMT -5. The time now is 10:55 AM.