-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetfilename.ps1
More file actions
27 lines (21 loc) · 985 Bytes
/
getfilename.ps1
File metadata and controls
27 lines (21 loc) · 985 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Set the path to the folder containing the images
$folderPath = "C:\Users\gorazem\Desktop\CaseyImages\images"
# Add support for WebP files to the ImageCodecInfo class
Add-Type -AssemblyName System.Drawing
$imageCodec = [System.Drawing.Imaging.ImageCodecInfo]::GetImageEncoders() | Where-Object { $_.FormatDescription -eq "WebP" }
# Get all the image files in the folder
$imageFiles = Get-ChildItem $folderPath -Filter *.* | Where-Object { $_.Extension -match '\.(jpg|jpeg|png|gif|bmp|webp)$' }
# Create an empty array to hold the data for each image
$imageData = @()
# Loop through each image file
foreach ($file in $imageFiles) {
# Get the SKU from the filename
$sku = $file.BaseName
# Add the data for this image to the array
$imageData += [pscustomobject] @{
sku = $sku
base_image = $file.Name
}
}
# Export the image data to a CSV file
$imageData | Export-Csv -Path "C:\Users\gorazem\Desktop\CaseyImages\image_data.csv" -NoTypeInformation