Saturday 14 October 2017

linux find command to move files


I have a folder with lots of images,I want to move all images which filename contains "cover" and size is bigger than 100K to /root/img. Below command can move all the files that filename contains "cover" but without size condition.My questions is how to combine with condition that image's size is bigger than 100K.thank you!


find . -name '*cover*' -exec mv '{}' /root/img  \;

Answer



find . -name '*cover*' -size +100k -exec mv '{}' /root/img \;

This command will move any file that contains the name "cover" and is greater than 100K.


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...