LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 08-29-2005, 11:09 AM   #1
msandford
LQ Newbie
 
Registered: Mar 2005
Posts: 7

Rep: Reputation: 0
Scripting question


Hi,
I'm doing some work scanning a large amount of files into a computer system. I'm stuck with the software that's been dumped on me for the time being, so I'm looking for a quick way to organize and name what I've got. Here's the current situation:

The scanning software propts for a job name, which is then used as a directory name. Each page is saved as an individual tiff file, 0000001.tif to xxxxxxx.tif, depending on the number of pages. So, each document sits in its own directory. The directory name is important, since it identifies what the document is. I'm scanning in Windows, but I've moved the files to my linux box.

My questions:

Can I use a script to automatically combine all the tiffs in a given directory (using tiffcp, perhaps) and convert to pdf (tiff2pdf?).

How can I make that script, and how can I make it run recursively, so I don't have to manually enter each directory?

Is it possible, once that's done, to run another script where each of the newly created PDFs are given the same name as the directory they sit in? The way things are set up, each directory should only contain a single PDF, so there won't be repeating filenames within a directory.

And while I'm at it, the scanning software is tossing in extra files I don't want. Is there a way to delete all files with a given extension within all subdirectories? Again, there's a lot of manipulation going on, all of it pretty basic, but it's spread out in so many sub directories that doing it by hand would take forever.

Thanks in advance for any help.

Mark

ETA: Just after I posted, I figured out how to delete the files in subdirectories, so all those .dat files are gone. Ignore the last question.

Last edited by msandford; 08-29-2005 at 11:28 AM.
 
Old 08-29-2005, 11:19 AM   #2
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 117Reputation: 117
Deleting files with a given extension (assumes .BAD, case insensitive, replace as needed):
Code:
find /directory -iname '*.bad' -print0 | xargs -0 rm
I will investigate your tiff issues and post any thoughts here later.
 
Old 09-03-2005, 01:55 PM   #3
msandford
LQ Newbie
 
Registered: Mar 2005
Posts: 7

Original Poster
Rep: Reputation: 0
Thanks for the help so far. That made things much easier for me. As for the tiff stuff, I wrote a basic script, and I'm just running it on each directory. It's time consuming, but it's got to get done.

Mark
 
Old 09-04-2005, 03:03 AM   #4
otoomet
Member
 
Registered: Oct 2004
Location: Tartu, Ċrhus,Nürnberg, Europe
Distribution: Debian, Ubuntu, Puppy
Posts: 588

Rep: Reputation: 45
try something like this:

Code:
cd dir_where_your_tiff_dirs_are
for dir in $(ls); do  # do the following on all files/dirs
  if [ -d $dir ]; then  # only if it is a directory
    cd $dir
    #do something with the files here...
    # perhaps remove the files
    cd ..
    # perhaps rmdir $dir
  fi
done
I haven't tested it, though.

Ott
 
Old 09-05-2005, 10:23 AM   #5
morrolan
Member
 
Registered: Sep 2003
Location: Manchester UK
Distribution: Frustrated Ubuntu 6.10 Edgy User
Posts: 257

Rep: Reputation: 30
I know I'm probably being cheeky here, but did you resolve this issue?

If you did, I'd love to take a look at the script you are using as I've just been lumbered with a similar job - for 30,000 pieces of A4 paper...

Many Thanks,
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
scripting question... Basslord1124 Linux - Networking 2 11-09-2005 05:52 AM
Scripting Question... Darklight451 Linux - Newbie 3 09-23-2004 05:03 PM
Scripting question sujte Linux - General 2 05-24-2004 04:52 PM
Scripting question aikitortoise Linux - Newbie 3 11-14-2002 05:18 PM
New to Scripting question s&j Linux - General 2 06-25-2002 08:27 PM


All times are GMT -5. The time now is 04:53 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration