daknetworks.com

You are here: Blog Rename Files

Rename Files

Let's say you have a bunch of files to rename. You want to minus the first 10 characters of each file. What's the best way?

It depends.

Total Commander

My favorite for small-to-medium batches is Total Commander. It understands REGEX and it shows the before-names and after-names before committing the command.

  • -highlight the files (they show as red filenames).
  • -click FILE > MULTI-RENAME-TOOL (the rename box shows)
  • -find RENAME-MASK (in the upper-left).
  • -type: [N10-]
  • -adjust according to your situation.
  • -click START (at the bottom-right).

This should do it!

Powershell

For powershell, the command will be something like:

get-childitem 'c:\path\to\file\*.txt | rename-item -newname { [string]($_.name).substring(8) }

Or if you need to split at an underscore "_".

Get-ChildItem'c:\path\to\file'|Rename-Item-NewName{ $_.BaseName.Split('_')[0]+ $_.Extension}

NOTES

https://www.ghisler.ch/wiki/index.php/Multi-rename_tool

Contact Dak Networks

We are not taking on new clients at this time.