Skip to content

Commit 0cff518

Browse files
committed
Added touch-image
1 parent 1f0bf46 commit 0cff518

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

media/touch-image.ps1

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Use case: modify media items without changing their visual content
2+
3+
# Usage: touch all PNG files in the images directory
4+
# Get-ChildItem ".\themes\images\" -Filter *.png -Recurse | ForEach-Object { Touch-File $_.FullName }
5+
6+
7+
function Touch-File {
8+
param ([string]$filePath)
9+
10+
$bytes = [System.IO.File]::ReadAllBytes($filePath)
11+
12+
# Append a harmless zero byte
13+
$bytes += 0x00
14+
15+
[System.IO.File]::WriteAllBytes($filePath, $bytes)
16+
}

0 commit comments

Comments
 (0)