Need to move folders older than 5 days to a bad up directory
I need to move folders that are 5 days old from Directory A and all there contents to Directory B
Can anyone help with that folders are named 20111228 20111229 20111230 20111231 20120101 and need to be moved to /opt/nas_share_link/archives |
Here's how you can do it from a terminal. Go to in a terminal to the folder where the files are. Then type:
[CODE] $ cp -R 20111228 /usr/nas_share_link/archives [CODE] Substitute in the new folder name as you copy a the other folders. |
Quote:
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 |
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.
Duplicate thread http://www.linuxquestions.org/questi...0/#post4575479 has been closed. Please read the LQ Rules. |
can you not just use
find /var/logfiles/ -type d -ctime +5 -exec mv '{}' /usr/nas_share_link/archvies \; havent tested it but is should be close to working. |
All times are GMT -5. The time now is 03:50 PM. |