Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

269
Views
Simple renaming - remove (JOB_0000_) from file name

I work with software that generates an output files with the names: JOB_1_sample-file_20220211083122.txt in a specific folder. There are thousands of files at the same time.

The beginning of the text file is variable (JOB_1,JOB_2,JOB_3,etc).

Example: JOB_2_sample-file_20220211083122.txt, JOB_34_sample-file_20220211083122.txt, JOB_1007_sample-file_20220211083122.txt.

I need to remove the initials from the files, leaving only the 'sample' forward. Preferably using Powershell, CMD or javascript.

Is there such a possibility?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Use Rename-Item with a delay-bind script block, combined with a -replace operation that uses a regex to remove the prefix of interest:

$dir = '.' # specify target dir.
Get-ChildItem -LiteralPath $dir -Filter *.txt |
  Rename-Item -NewName { $_.Name -replace '^JOB_\d+_' } -WhatIf

Note: The -WhatIf common parameter in the command above previews the operation. Remove -WhatIf once you're sure the operation will do what you want.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!