Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I move files older than 30 days from folder /storage/current/dbdumps/ to /storage/archive/dbdumps?

I tried:

find /storage/current/dbdumps/ -type f -mtime +30 -exec mv '{}' /storage/archive/dbdumps \;

but seems invalid in Ubuntu 11.04.

share|improve this question
2  
what is the error message? – enzotib Nov 19 '11 at 10:53

The command seems ok and in my 11.10 it works. Haven't you missed the trailing slash in the destination folder?

find /storage/current/dbdumps/ -type f -mtime +30 -exec mv '{}' /storage/archive/dbdumps/ \;

Other thing you may try is using /bin/mv insted of just mv.

share|improve this answer

You can try this version (works in 11.10, i guess it will work in other versions too :) ):

find /storage/current/dbdumps/ -type f -mtime +30 -print | xargs -I {} mv {} /storage/archive/dbdumps
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.