![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
![]() |

|
| Linux and Unix Error ! Redhat,suse,centos,mandrake,Free BSD,Sun |
![]() |
|
List of files that exclude some files
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Administrator
Posts: 18,702
Join Date: Jan 2006
Rep Power: 10
IM:
|
Reason is I am periodically searching a folder e.g. /foo/* for jpg files that have not been processed. A processed file will have an accompanying with the same filename but different extension. This file denotes that the jpg was previously processed. I want to then ignore this file the next time I process the folder. So, I would like to be able to: List all jpg files that do not have an accompanying file. E.g. in a folder, their contains files, a.jpg, b.jpg, c.jpg, d.jpg, d.mod. I would like a list of files in that folder that would exclude the d.jpg file, leaving a.jpg, b.jpg, c.jpg. Want to be able to process a folder recursively. Either throw all the files to a list file, to then process through with a loop or possibly execute the command inline with the search. E.g. the command I can run to process and replace the existing jpg file is mogrify quality 50 /path/to/foo.jpg > /path/to/foo.compressed Any help would be greatly appreciated. |
|
|
|
|
|
|
|
|
#2 (permalink) |
|
Administrator
Posts: 18,702
Join Date: Jan 2006
Rep Power: 10
IM:
|
It might be overkill to call bash for each jpg found using exec, especially when there are many jpgs... @OP, in bash, for one directory. I leave you to find a way for recursive. for i in *.[jm][op][gd] do prefix=${i%%.*} if [ -f ${prefix}.jpg -a -f ${prefix}.mod ];then continue else echo "$i" #do your image processing here. fi |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|