Issue: How to upload cache icons into new server

I have a new server and wish to upload icons from a previous server. I’m on Win10

I have gone to appdata>Roaming>TS3Client>cache>(correct server folder)>icons

However, all are blank and not png or other acceptable file types. I have tried opening up Powershell on the icon folder and running “cmd ren *. *.png” but there is no effect.

What else can be done?

Wonderful, thank you! Any chance I can do this on a mass scale instead of individually?

using windows PowerShell:
Get-ChildItem | Rename-Item -newname {$_.name + ".png"}

This is a pretty basic way of doing this because it relies on the image viewer to detect the actual image format (not all icons are pngs - there are also gif, jpg, svg).
To accommodate this you need a few more steps.

second script
function Get-FileType {
    [CmdletBinding()]
    param (
        # Path to file.
        [Parameter(Position = 0, ValueFromPipelineByPropertyName)]
        [string[]] $Path
    )

    begin {
        # description, hex signature, byte offset, byte limit
        $fileSignatures = @(
            @('JPG','FFD8FF',0,3),
            @('PNG','89504E470D0A1A0A',0,8),
            @('GIF','474946383761',0,6),
            @('GIF','474946383961',0,6),
            @('ICO','00000100',0,4),
            @('SVG','3C',0,1)
        )
    }

    process {
        foreach ($filePath in $Path) {
            if (Test-Path $Path) {
                foreach($signature in $fileSignatures) {
                    if($thisSig = Get-FileSignature -Path $filePath -HexFilter $signature[1] -ByteOffset $signature[2] -ByteLimit $signature[3]) {
                        Write-Output $signature[0]
                    }
                }
            }
            else {
                Write-Warning "$filePath not found!"
            }
        }
    }
}
  • open a powershell or cmd in the folder containing the images
  • allow powershell scripts by starting a new shell with correct execution policy:
    powershell -ExecutionPolicy Bypass
  • add the first script:
    Import-Module Drive:\path\to\Get-FileSignature.ps1
  • add the secondscript:
    Import-Module Drive:\path\to\Get-FileType.ps1
  • rename all files
    Get-ChildItem | Rename-Item -newname {$_.name + "." + (Get-FileType $_.name)}

This is the easiest way I found to do all this correctly.

1 Like