Showing posts with label find. Show all posts
Showing posts with label find. Show all posts

Feb 18, 2014

[memo] Delete files older than xxx days on Linux

find /opt/myapp/log/ -mtime +120 -type f -exec rm {} \;

http://www.howtogeek.com/howto/ubuntu/delete-files-older-than-x-days-on-linux/

Nov 17, 2013

[memo] Print file names that contain word and exclude extension.

### command
find ${TARGET_DIR}/*.xml -type f | xargs grep -l ${SEARCH_WORD} | awk '{ num = split($0, array, "/"); print array[num];}' | awk '{ num = split($0, array, "."); print array[1];}'