You can use the Scripting (tools, references, microsoft scripting runtime reference) to loop through the folder A. For each one there, evaluate if the filename contains (let's say) .jpg in it. If so, add it to an array, then delete all files in array.
Something like:
dim fso as...