G
G
Goobert Crypto2020-05-05 10:40:11
cmd/bat
Goobert Crypto, 2020-05-05 10:40:11

How to remove dash in file name?

There is a file te-st.txt how to remove a dash in the file name so that the file is of this type test.txt using a batch file? Provided that there are a lot of such files with a dash
For example

ert-ert.txt
Oto-to.txt
...

How to remove dashes in all of them while preserving the content

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman Bezrukov, 2020-05-05
@goober-crypto

For the current directory:
Get-ChildItem *.txt | Rename-Item -newname {$_.name -replace '-',''}
The name of the desired directory can be specified in the first cmdlet...

I
Ivan Dobroslavin, 2020-07-10
@derzost_namereniya

I also tried with images in jpg format, but it did not work. Launched from PowerShell in Windows 10 in the same directory as the files, changed txt to jpg. Maybe there is a condition that the files start with fi, but my names are different?
5f086787d2199964672627.png
5f0868d0a6c4d900916852.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question