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

English Edit question
Ubuntu gwenview Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:
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.
#! /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

for i in $( find $1 |egrep -i '(\.jpg$|\.jpeg$|\.gif$|\.png$|\.xpm$|\.xbm$|\.bmp$|\.pcx$)')
   if [ -f $2/$(basename $i) ]
      cp $i $2/$(basename $i.$ext)
      ext=$( expr $ext + 1 )
      cp $i $2
gwenview $2
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.