locked
Remove String Filename RRS feed

  • Question

  • How can I remove a string from the name of many files? I have these names and I want the following:

    BKP_20170505_file01.bak  -->  file01.bak
    BKP_20170505_file02.bak  -->  file02.bak
    BKP_20170505_file03.bak  -->  file03.bak
    BKP_20170505_file04.bak  -->  file04.bak

    Thanks!


    Thursday, May 25, 2017 8:57 AM

Answers

  • ('BKP_20170505_file01.bak'  -split '_')[-1]


    \_(ツ)_/

    • Marked as answer by SysAdm.MAC Thursday, May 25, 2017 10:03 AM
    Thursday, May 25, 2017 9:16 AM

All replies

  • 'BKP_20170505_file01.bak' -replace 'BKP_20170505_'

    \_(ツ)_/

    Thursday, May 25, 2017 9:04 AM
  • Hi JRV

    If you change the date or the data, as you could parameter that removes everything on the left of the second _?

    Thursday, May 25, 2017 9:10 AM
  • ('BKP_20170505_file01.bak'  -split '_')[-1]


    \_(ツ)_/

    • Marked as answer by SysAdm.MAC Thursday, May 25, 2017 10:03 AM
    Thursday, May 25, 2017 9:16 AM