By the way, K Craig wanted to rename all the files at once. In the rename file/Location tab, check "Is regex" and enter .*_\d{12}\.(txt|asc) in the include file mask to match files ending with an underscore followed by 12 digits and with an extension of txt or asc. Then in the rename settings tab, use this for the post process mask:
{REGEX(Replace|{NEWNAME()}|_\d{12}|)}
which replaces the underscore and 12 digits with NULL.
You may want to run a powershell script to do that. Here's one way should you want to give it a try based on this article:
https://devblogs.microso...to-rename-files-in-bulk/ Create a job with a job variable that holds the path where the files live. I call it JobWorkingDir. Then create a powershell task where you have 1 parameter called SourcePath that is set to the job variable.
The script uses Get-ChildItem to list all the files in SourcePath. Then Where-Object filters the list to include only the files that match the regex of files that match starting with anything then ending in an underscore followed by 12 digits then a literal dot then the extensions txt or asc (as stated in the example. Tweak for your needs). Then that filtered list is passed to Rename-Item where the underscore and 12 digits are replaced with NULL, effectively deleting them.
Param(
[Parameter(Mandatory=$true)]
[string] $SourcePath
)
Get-ChildItem -Path $SourcePath | Where-Object -FilterScript {$_.Name -match ".*_\d{12}\.[txt|asc]"} |
Rename-Item -NewName { $_.name -replace '_\d{12}', ''}
To make it even more versatile, make parameters for what to filter on and match/replace as well.
Edited by user
2020-02-18T22:42:27Z
|
Reason: Not specified