Mark0's Forum

F.A.Q. => TrID => Topic started by: Mark0 on April 20, 2010, 06:14:48 PM

Title: Tip: Recursively fix files extensions with TrID using PowerShell
Post by: Mark0 on April 20, 2010, 06:14:48 PM
This tip was suggested by Nath and and could interest users of the Windows PowerShell (http://en.wikipedia.org/wiki/Windows_PowerShell)

Code: [Select]

Foreach ($1 in gci -recurse -name C:\folders_to_scan\) {$1 = "C:\folders_to_scan\" + $1 ; C:\trid_path\trid.exe $1 -ae}


Replace C:\folders_to_scan\ with the directory that you want to scan by TrID to fix the extensions (including the subdirectories).

Replace c:\trid_w32\ with the path to trid.exe.


It's also possible to exclude files with common extensions with something like:

Code: [Select]

Foreach ($1 in gci -recurse -name -exclude *.exe, *.doc, *.xyz C:\folders_to_scan\) {$1 = "C:\folders_to_scan\" + $1 ; C:\trid_path\trid.exe $1 -ae}


A filemask like *.* will exclude any file with an extension (and so analyze only the ones without).