[ubuntu-in] Strange problem with too many jpg files in one folder

Ritesh Sinha ritesh.kumar.sinha at gmail.com
Wed Aug 25 15:43:27 BST 2010


On Wed, Aug 25, 2010 at 07:47:12PM +0530, Ramnarayan.K wrote:
> Looking at help i modified the script - corrected my errors and used
> this (and the result it below)
> 
> # find /home/himal/ -name image3*.jpg -a size +20000 -mtime -2 -exec
> mv '{}' /home/himal/Pictures/recovered/bigger800kb/ \;
> find: paths must precede expression: image301001.jpg
> Usage: find [-H] [-L] [-P] [-Olevel] [-D
> help|tree|search|stat|rates|opt|exec] [path...] [expression]
> 

Sorry, here is  slightly more hackish solution. Save it as a bash script
make it executable using chmod and let me know how it goes

#!/bin/bash
FILESIZE=1000 #smallest file in bytes
for file in *.jpg;
do    
        sz=$(du -h -b "$file" | cut -f1)
	if  [ $sz -gt $FILESIZE ] ; then 
	cp $file /ANOTHERFOLDER/ #i suggest you use replace cp with mv
        fi  
done

I'm sure there are better ways to do this :)

- Regards
Ritesh



More information about the ubuntu-in mailing list