In case of renaming multiple file extensions to another, they suggested to type this command in cmd promt or powershell: ren *.(current extension name) *.(new extension name)

But what about to renaming multiple file extensions to nil or no file extension? How to replace this command *.(new extension name) ?

  • SpaceNoodle@lemmy.world
    link
    fedilink
    arrow-up
    2
    arrow-down
    1
    ·
    edit-2
    1 year ago
    1. Set up WSL
    2. for file in * ; do mv “$file” $(basename “$file”) ; done

    Edit: the other commenter is right, I fucked up the usage of basename.

    • FooBarrington@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      1 year ago

      No, that doesn’t work, you have to pass the suffix you want to remove to basename:

      $ touch test.txt
      $ basename test.txt
      test.txt
      $ basename test.txt .txt
      test