Author Topic: Tip: Recursively fix files extensions with TrID using PowerShell  (Read 44999 times)

Mark0

  • Administrator
  • Hero Member
  • *****
  • Posts: 2667
    • Mark0's Home Page
This tip was suggested by Nath and and could interest users of the 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).
« Last Edit: April 21, 2010, 05:40:16 PM by Mark0 »