LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   faster way to move old file (https://www.linuxquestions.org/questions/linux-newbie-8/faster-way-to-move-old-file-735180/)

ust 06-24-2009 01:56 AM

faster way to move old file
 
I have thousands files in a path , I tried to use command "find" to move the old file (elder than 150 days) to another path , but it takes 1 day but only move 15% of these files , and the server also become very slow .


the command

find . -mtime +150 -exec mv {} path \;


If I use these way to move files , I think I need 3-4 days more , can advise what is the faster way to move file ? thx

David the H. 06-24-2009 07:37 PM

As I understand it -exec will execute the command separately for each of the files matched. You can make it more efficient by piping the list into xargs instead, which will run them all in a single process.

I'm not sure how much of a difference that will make, or how well it can handle such a large load though.


All times are GMT -5. The time now is 02:35 PM.