LinuxQuestions.org
Have you heard the LinuxQuestions.org Podcast?
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices

Tags used in this thread
Popular LQ Tags , ,

Reply
 
Thread Tools
Old 07-09-2007, 04:34 AM   #1
Andy17MB
LQ Newbie
 
Registered: Jul 2007
Location: Sowerby Bridge, West Yorks, UK
Distribution: Ubuntu 7.04 (Feisty)
Posts: 2
Thanked: 0
Bash Scripting Problem with Imagemagick in Ubuntu 7.04


[Log in to get rid of this advertisement]
Hi,

I am using a basic Bash script that should run through all the jpeg files in a directory resizing them and writing them to the same filename in a different directory.:

Code:
ls *.jpg | xargs -I FILE convert FILE -resize 1000x1000 hq/*.jpg
This code used to work but now writes all the files to a file in the correct dirtectory called "*.jpg"

I am sure I am doing something daft, I just can't see what. Can anyone help?

Thanks

Andy
Andy17MB is offline  
Tag This Post , ,
Reply With Quote
Old 07-09-2007, 05:13 AM   #2
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 2,974
Thanked: 37
Hi.

I believe using *.jpg twice like this works in DOS, but not in a real shell.

You should probably loop with something like:
Code:
for file in *.jpg;
  do
    convert "$file" -resize 1000x1000 hq/"$file"
done
ilikejam is offline     Reply With Quote
Old 07-09-2007, 07:03 AM   #3
Andy17MB
LQ Newbie
 
Registered: Jul 2007
Location: Sowerby Bridge, West Yorks, UK
Distribution: Ubuntu 7.04 (Feisty)
Posts: 2
Thanked: 0

Original Poster
That's got it..

Ilikejam,

Thanks for the pointer. That's a much better way of doing it. I've also got it creating thumbnails in the loop too. Right I'm off to look for some Bash Scripting tutorials to see if I can avoid needing to ask daft questions in future.

Thanks again for the help

Andy
Andy17MB is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

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
Bash Scripting Problem... utopian_penguin Linux - General 11 11-08-2006 02:39 PM
BASH scripting problem danreed007 Programming 5 04-24-2006 06:02 AM
bash scripting problem sutley Linux - Software 1 12-17-2004 12:33 PM
BASH scripting problem deadlock Programming 5 08-15-2003 05:33 AM
bash scripting problem raven Programming 7 03-10-2003 06:48 PM


All times are GMT -5. The time now is 03:56 AM.

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
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration