Tip: Recursively fix files extensions with TrID using PowerShell

Started by Mark0, April 20, 2010, 06:14:48 PM

Previous topic - Next topic

Mark0

This tip was suggested by Nath and and could interest users of the Windows PowerShell



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:



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).