Jump to content

Finding out which jpg file doesn't have a corresponding png file.


Recommended Posts

Here's one I really need some help with.

I have some images in a folder, say d:\images. In this folder are jpg images, ...ie ...xxx.jpg. AND, some of these jpgs' have been converted to a png file (using same filename, just with a different extension). What I need to do is search thru the d:\images directory, ... and copy ANY jpgs' that do NOT have a corresponding png file... over to a folder named d:\temp. So, after completion, ... d:\temp will contain jpg files that have not been converted to the png format.

If anyone can do this ..... FREE BEER all Around!!!!!!

thank you in advance!

Allen

Link to comment
Share on other sites

I would like the beer in advance please.

Please send to:

1234 Fake Street,

Fake City,

Fake Country

;)

Seriously though, no one is likely to write the script for you, unless they are bored or something.

So here is some functions to look at:

FileExists()

FileCopy()

Post some code and people might be more willing to help. :D

Link to comment
Share on other sites

My biggest challange is trying to figure out how to .."sequence thru" the folder ... to perform the FileExists commands...

BTW, I sent that beer, but it came back, .. broken and non deliverable! :D

Allen

I would like the beer in advance please.

Please send to:

1234 Fake Street,

Fake City,

Fake Country

;)

Seriously though, no one is likely to write the script for you, unless they are bored or something.

So here is some functions to look at:

FileExists()

FileCopy()

Post some code and people might be more willing to help. ;)

Link to comment
Share on other sites

#include <file.au3>
#include <array.au3>

$jpgs = _FileListToArray("D:\images", "*.jpg")
$pngs = _FileListToArray("D:\images", "*.png")

_ArraySort($pngs, 0, 1)

For $a = 1 To $jpgs[0]
    If _ArrayBinarySearch($pngs, StringReplace($jpgs[$a], ".jpg", ".png"), 1) = -1 Then
        FileCopy("D:\images\" & $jpgs[$a], "D:\temp\" & $jpgs[$a])
    EndIf
Next

No beer for me. Alcohol is bad for the body.

Edited by Richard Robertson
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...