Running a script on all files in a Directory

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
degolf
Newbie
Posts: 2
Joined: Wed Nov 23, 2005 4:40 am

Running a script on all files in a Directory

Post by degolf » Wed Nov 23, 2005 5:13 am

I would like to automate a function with Photoshop. I want to run a sharpening process on all image files in a directory. I would start on the first file and do all files in order. How do I get the script to iterate down the file list? I am opening a file in one directory sharpening it and then saving it in another directory and then want to loop and do this again on the next file in the first directory. I will end up at the end with the files duplicated in the second directory and all sharpened.

Thanks for any ideas.

David Egolf

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Wed Nov 23, 2005 8:05 am

Use GetFileList.
MJT Net Support
[email protected]

IanSmith
Junior Coder
Posts: 24
Joined: Tue Jul 12, 2005 2:31 pm

Post by IanSmith » Wed Nov 23, 2005 10:30 am

I've been using a slightly easier (to me) method for this, by piping a DIR command into a text file.

Try this:

run>cmd.exe /c dir /b *.jpg > c:\temp\filelist.txt

filelist.txt now contains a list of the files which can be scanned using readln.

The /b switch for dir returns only the file name without the extra information.

Hope that helps,

Ian

tommytx
Pro Scripter
Posts: 61
Joined: Mon Dec 22, 2003 3:20 am

Post by tommytx » Sat Nov 26, 2005 1:43 am

Ian

What a great tip! Use /c to get file name only. I been doing dos for 20 years and never came across that. I have used the dir > temp.txt for years to get a directory into a file and then had to write the prorgam to get rid of all the other un-necessary directory junk. Thanks again. I wil be using that a lot. Ok all you old dos guys you probably knew this long ago, but I just learned.

Tom

tommytx
Pro Scripter
Posts: 61
Joined: Mon Dec 22, 2003 3:20 am

Post by tommytx » Sat Nov 26, 2005 1:47 am

Degolg,

They have a lot of absolutely great batch scripts for photoshop within the photoshop environment. Not to say mjt macro won't work great also, but I have used the batch processing there and they drill down just like you wouldn't believe. Its almost like the mjt recorder that works so well here, but the batch for photoshop is designed just for photoshop. You can find a lot of samples on the web under "photo shop batch processing".
Maybe you already looked at batch and it wouldn't work for you. This is not the dos batch we all know so well.

Tom

User avatar
CyberCitizen
Automation Wizard
Posts: 721
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Post by CyberCitizen » Tue Nov 29, 2005 4:57 am

You Could Also Try Irfan View, That Has A Batch Processing Option Which Might Be Better Suited To Your Needs, You Could Then Use MS To Automate That.
FIREFIGHTER

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts