I have a set of files in dir1/ over 1600. I clearly see the difference in speeds of using find over forloop.
time find dir1/ -type f -exec mv {} dir2/ \;
real 0m1.194s
user 0m0.427s
sys 0m0.764s
time for i in `ls dir2/` ; do mv dir2/$i dir1/ ; done
real 0m1.687s
user 0m0.489s
sys 0m1.171s
There is lot of gain in terms of realtime as well as system time.
No comments:
Post a Comment