• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 217
  • Last Modified:

Remove all jpegs les than 1k from a folder

Hi i am new to linux so sorry for the no braner question but how do i remove all jpg files less than 1k from a spesific folder?
its to go in a cron script
thanks for you help
0
kingpin200004
Asked:
kingpin200004
  • 2
1 Solution
 
ravenplCommented:
find /dir -name '*.jpg' -size -10k -exec rm -f {} \; # will remove all *.jpg within /dir and subdirs that are smaller than 10KB
want some moification? Ask or read 'man find'

for testing purposes You may issue
find /dir -name '*.jpg' -size -10k -print
0
 
ravenplCommented:
Also if You expect large number of files in one run, You can speed it up with
find /dir -name '*.jpg' -size -1k -printf "'%p'\n" | xargs rm -f
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now