coerrace
asked on
jpg check on a batch and skip a task
Hello I have this code someone helped me here:
This is the original link with all explanation and history:
http://www.experts-exchang e.com/OS/M icrosoft_O perating_S ystems/MS_ DOS/Q_2848 7439.html# a40232102
Is working perfect no problem at all. What it does is look for PDF's inside all sub directories inside "c:\data\" then convert that pdf's to jpg and that jog is stored in the same directory the original pdf it is. For example we have just one sub directory inside "c:\data" called "one" it means "c:\data\one" and that sub directory "one" has 2 pdfs called 1.pdf and 2.pdf (of course is an example only names could be anything and sub directories is insde "c:\data" could be any number). Now if you run the script add inside "c:\data\one" 2 jpgs called 1.jpg and 2.jpg because like I mentioned before the converted jpgs must be with the name of the original pdf of where it was converted and saved in same location of that original pdf.
Now the script does exactly like we want is prefect but someone could help us in add in the code a condition that if the jpg corresponding to one pdf exist in the directory and skip the conversion and continue with the other file and so on with all sub directories inside "c:\data" and all pdfs inside each sub directory of "c:\data". We want to do this because we add new sub directories to "c:\data" so frequent and there a re a lot of new sub directories and if we run the script process all and re-convert all the already converted files and there is no need to re-convert what it was converted because takes so long talking in days times.
I hope someone can help.
Thank you
@echo off
forfile /p "c:" /s /m *.pdf" >junk.text
for /f "tokens=1 delims=." %%F in ('type junk.txt') do (convert %%F.pdf" %%F.jpg")
del junk.txt
This is the original link with all explanation and history:
http://www.experts-exchang
Is working perfect no problem at all. What it does is look for PDF's inside all sub directories inside "c:\data\" then convert that pdf's to jpg and that jog is stored in the same directory the original pdf it is. For example we have just one sub directory inside "c:\data" called "one" it means "c:\data\one" and that sub directory "one" has 2 pdfs called 1.pdf and 2.pdf (of course is an example only names could be anything and sub directories is insde "c:\data" could be any number). Now if you run the script add inside "c:\data\one" 2 jpgs called 1.jpg and 2.jpg because like I mentioned before the converted jpgs must be with the name of the original pdf of where it was converted and saved in same location of that original pdf.
Now the script does exactly like we want is prefect but someone could help us in add in the code a condition that if the jpg corresponding to one pdf exist in the directory and skip the conversion and continue with the other file and so on with all sub directories inside "c:\data" and all pdfs inside each sub directory of "c:\data". We want to do this because we add new sub directories to "c:\data" so frequent and there a re a lot of new sub directories and if we run the script process all and re-convert all the already converted files and there is no need to re-convert what it was converted because takes so long talking in days times.
I hope someone can help.
Thank you
ASKER
oBdA appers is working just ine thing if you have source directory like "c:\data new exploration" with spaces not work it just worj for directories like ."c:\anydir" without spaces.
Could you check to accept spaces in source directory?
Thank you
Could you check to accept spaces in source directory?
Thank you
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Is working yes I was entering quotes "" is working all and script is more robust than o,d one to do the same.
Thank you
Thank you
Open in new window