简体   繁体   中英

How to remove specific characters from a file name?

I have bunch of files that need to have a (.) dot removed from the file-name. Eg. "Mr.-John-Smith.jpg" to "Mr-John-Smith.jpg". I don't have real experience with programming and know only html/css and a little javascript. I found another identical question here on stackoverflow, but what I gathered it was fixed on linux system and BASH was used.

Anyways, if anyone could provide me a tutorial on which program to use for this and what code to execute in that program to make it happen I'd be grateful.

if you are using a windows environment (which i guess you do)

you can download this free utility to mass change file names !

main page : http://www.bulkrenameutility.co.uk/Main_Intro.php

download page : http://www.bulkrenameutility.co.uk/Download.php

its easy to use

enjoy

If your file names in a file...

1- Open Microsoft Word or any text editor. Press ctrl+h and then search " . " without quotes then replace it with blank character.

2- It will remove all dots, again bring "." to your file extention such as .jpg , .png searh your file extention for example "jpg" and replace it with ".jpg"

It will works %100, i am using this method everytime.

if they are not in a file and if you want do somethings in your operation systems' file system

Try this program. It is very useful for this operation;

Download

To remove all except the extension dot from all files in a directory, you can use PowerShell that comes with newer versions of Windows, and can be downloaded for older versions; Line breaks inserted for readability, this should go on one line;

PS> dir | rename-item -newname {       
       [System.IO.Path]::GetFileNameWithoutExtension($_.name).Replace(".","") + 
       [System.IO.Path]::GetExtension($_.name); }

What it does is to take the file name without an extension and remove all dots in it, and then add back the extension. It then renames the file to the resulting name.

This will change for example do.it.now to doit.now , or in your case, Mr.-John-Smith.jpg to Mr-John-Smith.jpg .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM