Another way is without loops
find . -type f -not -name "*.*" -print0 |\ xargs -0 file |\ grep 'JPEG image data' |\ sed 's/:.*//' |\ xargs -I % echo mv % %.jpg
Structure:
- find all files without extension
- check file type
- Filter only jpg files
- delete file information
- xargs runs "mv" for each file
the above command is for dry running, after it you must remove the "echo" before mv
jm666 May 24 '11 at 19:40 2011-05-24 19:40
source share