Last active
March 6, 2018 19:57
-
-
Save csereno/c9fb7a3b444b9c9f0db408d29a399b21 to your computer and use it in GitHub Desktop.
PowerShell script to rename file(s) to WireShark fileset format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Created by csereno | |
# 1. Copy the file into a folder on your PC | |
# 2. Add the capture files to the folder | |
# 3. Run the script | |
# | |
$capname = Read-Host -Prompt "What is the new file name?" | |
$i=1 | |
dir *.*cap* | %{Rename-Item $_ -NewName ($capname + '_{0:D5}{1}' -f $i++,($_.Extension -replace '[^a-zA-Z.]',''))} | |
dir *.*cap* | Rename-Item -NewName {$_.BaseName+'_'+$_.LastWriteTime.ToString('yyyyMMddHHmmss')+($_.Extension -replace '[^a-zA-Z.]','')} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
added code to strip numbers from the end of the file in the extension