Sign in to follow this  
Followers 0
crabboy

Script for finding all JPEG's in all subfolders of dir.

3 posts in this topic

Hello, im trying to write a script that will go through a folder, pick out the JPEG's and then resize them changing the name to "BACKUP"originalname.jpg.

Im using a DOS command to give me a superdirlist, THE PROBLEM IS... it is only running through this sequence once but on that one go its working fine. So its only re-sizing one image. 

here is my script so far: (ill just include the part i think there is a problem with but let me know if any more would help)

$file = "E:ImageResizeNEWsuperdirlist.txt"

 

For $i = 1 to _FileCountLines($file)
    $line = FileReadLine($file, $i)
 
    FileClose($hFileOpen)
 
Local $filename = StringSplit($line, "")
For $i = 1 To $filename[0] ; Loop through the array returned by StringSplit to display the individual values.
        $doescontain = StringInStr($filename[$i], ".jpg")
If $doescontain <> 0 Then
MsgBox($MB_SYSTEMMODAL, "", "$filename[" & $i & "] - " & $filename[$i])
 
 
        EndIf
 
Next
 
Here is the contents of my superdirlist.txt:
 
E:ImageResizeNEW20140316_162236.jpg
E:ImageResizeNEW20140316_162246.jpg
E:ImageResizeNEWFolder
E:ImageResizeNEWsuperdirlist.txt
E:ImageResizeNEWFolder20140406_142320.jpg
 
THANK YOU!!!!!
 
 

 

Share this post


Link to post
Share on other sites



First of all, get rid of all of that code.

Look up _FileListToArrayRec in help file.

It will return an array of all .jpg files in your folder and subfolders.

You then loop through it and do whatever it is you do with them.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Thank you John that will save lots of time!

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  
Followers 0