How can I recursively view a complex image directory?

Asked by aztechrome on 2007-04-06

1. How can I recursively view a complex image directory in Gwenview?

2. Is there any way to, at that same time, pull each image from a complex directory structure recursively and dump output to ONE folder which does not retain directory structure?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu gwenview Edit question
Assignee:
No assignee Edit question
Solved by:
Skrynesaver
Solved:
2007-04-09
Last query:
2007-04-09
Last reply:
2007-04-08
aztechrome (aztechrome) said : #1

If not natively supported, can anyone formulate a command line to pass to Gwenview which can accomplish the -plaindump-?

Best Skrynesaver (philip-quinlan) said : #2

Hi Aztecchrome,

As you have probably noticed if you give two images in different directories to gwenview it opens the browser in the directory of the first argument. This isn't really a flaw it's what gwenview does, gthumb takes a more "file centric" view of things and will allow you specify many files as arguments eg to find all files with image extensions in a given directory
[code]gthumb $( find ~/data/graphics/ |egrep -i '(\.jpg$|\.jpeg$|\.gif$|\.png$|\.xpm$|\.xbm$|\.bmp$|\.pcx$)' )[/code]

However since you also wish to copy all these files to a single directory you could copy the following into a file using your favorite editor save the file and make it executable.
[code]
#! /bin/bash

if !( [ -d $1 ] && [ -d $2 ] );then
   echo "You must supply two directory names, the Source and destination ie
        $0 <source_directory> <destination_directory>
will copy all files with image extensions under source_directory into destination_directory avoiding name conflicts."
   exit 1
fi

ext=0
for i in $( find $1 |egrep -i '(\.jpg$|\.jpeg$|\.gif$|\.png$|\.xpm$|\.xbm$|\.bmp$|\.pcx$)')
   do
   if [ -f $2/$(basename $i) ]
   then
      cp $i $2/$(basename $i.$ext)
      ext=$( expr $ext + 1 )
   else
      cp $i $2
   fi
done
gwenview $2
[/code]
Call this with the source and destination directories
WARNING: No allowance is made in this script for filenames with spaces in them

aztechrome (aztechrome) said : #3

Thanks Skrynesaver, that solved my question.

aztechrome (aztechrome) said : #4

Also, the script works GREAT!
I made one small addition, since I have to process large numbers of geograhical images across the web and added the extra variable.

It's amazing how quickly one forgets one's control logic.
"oh duh", I said, after trying to write that little bit of management script.

I've merged it with a few other scripts that I use to further process the daily archive.
If it ever becomes anything besides a horrible mess of spaghetti calls, I'll put up the mutant script.

Thanks again.