|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||
|
||||
|
Hi! On my Ubuntu I have thousands of files in a couple hundred directories. I'm trying to convert the pdf's to jpg's. I used this command in terminal: Code:
for fname in *.pdf; do convert $fname ${fname%.pdf}.jpg; doneIt works great but the problem is I have to run this in terminal for each folder/directory so it's time consuming. Is it possible to covert all the pdf's in the sub directories from the root directory at once in terminal? Thanks for your help
Last edited by radoulov; 01-13-2013 at 03:36 PM.. Reason: Marked as solved. |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
Quote:
use find - you can traverse your directories with it, and even start your conversion per each file found. There are more efficient methods, but this depends on the amount of the files you have. Have a look at the manual page of find(1), but one way to accomplish your target would be something like: Code:
find the_root_directory_of_pdfs -name \*.pdf -exec convert \{\} \{\}.jpg \;The {} marks the filename found, and because of the shell the braces have to be escaped, as well as the command-ending semicolon. There are also other, more CPU-friendly methods, but this may serve as a one-time solution. BR, pen EDIT: Umm, I just noticed you want the change the filename extention for good - my solution leaves file names as foo.jpg.pdf... With find, this would work: Code:
find root_of_pdfs -name \*.pdf | while read fname; do convert $fname ${fname%.pdf}.jpg; doneLast edited by pen; 01-13-2013 at 09:30 AM.. Reason: See section EDIT... |
| The Following User Says Thank You to pen For This Useful Post: | ||
martinsmith (01-13-2013) | ||
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
Quote:
Yes Thanks you this is exactly what I needed! ![]() It's worked perfectly after testing and done the conversion of all the pdf files to jpg. Thanks very much for your help, I appreciate it! Bets Regards Martin |
| Sponsored Links | ||
|
![]() |
| Tags |
| imagemagick, linux, shell bash |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Create a dummy file in all directories that include a .jpg | Davinator | Shell Programming and Scripting | 11 | 04-03-2012 06:12 PM |
| Converting EPS to JPG issue | rlopes | UNIX for Dummies Questions & Answers | 0 | 01-11-2012 07:41 PM |
| Converting multiple latex files to pdf | Element9 | UNIX for Dummies Questions & Answers | 2 | 01-09-2009 12:10 PM |
| AIX converting PDF to PS | vinayakshukre | AIX | 3 | 12-11-2008 05:14 AM |
| PDF/EPS to GIf/JPG Help!! | PookJP | UNIX for Dummies Questions & Answers | 1 | 06-26-2001 06:45 PM |
|
|