Jump to content
Sign in to follow this  

Parsing filenames within folders to an external program

Recommended Posts


Hello and sorry thank you for reading this.

I am trying to accomplish the following:

I have 5000 image files in sub-folders that are currently in TIF format. I am using ImageMagick to resize them to a specific resolution and convert them to JPG format.

the command string for imagemagick is:

convert -resize 2400 file.tif file.jpg

I found this script that goes Recursive File Listing and logs that into a file. The script seems to be doing part of what I need, but for each filename instead of logging it into a file I need parsing it and executing the external "convert" program. Destination folder can be the same as where the original file resides. Can someone give me a hint or help me accomplish something like that? I have used Autoit, but only for automated website testing and only using certain internet explorer functionality that really does not apply here.

Any of your help will be highly appreciated.

Thank you. Script follows:

;Recursive File Lister

Dim $FolderName = "C:\Documents and Settings\Administrator.DAGNET02\Desktop\ADAM-FINLI"

Dim $FileCount = 0


MsgBox(0,"Done","Folder Scan Complete. Scanned " & $FileCount & " Files")

Func ScanFolder($SourceFolder)

Local $Search

Local $File

Local $FileAttributes

Local $FullFilePath

$Search = FileFindFirstFile($SourceFolder & "\*.*")

While 1

If $Search = -1 Then



$File = FileFindNextFile($Search)

If @error Then ExitLoop

$FullFilePath = $SourceFolder & "\" & $File

$FileAttributes = FileGetAttrib($FullFilePath)

If StringInStr($FileAttributes,"D") Then








Func LogFile($FileName)

FileWriteLine(@ScriptDir & "\FileList.txt",$FileName)

$FileCount += 1



Share this post

Link to post
Share on other sites

@BBB.. This should be pretty straight forward...

Just replace the "FileWriteLine(@ScriptDir & "\FileList.txt",$FileName)" line with the following command (See Helpfile):

Run(@ComSpec & " /c " & 'convert -resize 2400 ' & $FileName, "", @SW_HIDE)

This will work if you want all the images to resize to 2400.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this