1

Possible Duplicate:
How can I mass rename files from the command line or using a 3rd party tool?

I have many PDFs of EBooks but some of them have underscores in their filenames so it becomes difficult to search the file by some words. Is there any program/script/software which replace all underscores with blank space in windows 7

Mirage
  • 2,863
  • 8
  • 48
  • 66
  • Definitely a dupe. – EBGreen Jun 14 '11 at 15:44
  • Duplicate post [(link)](http://superuser.com/questions/65966/batch-file-to-replace-a-single-character-in-windows-filenames/65995?noredirect=1#comment772523_65995). Here's your one-liner CLI answer - without installing additional software: `for /f "tokens=* delims= " %i in ('dir /b "*.pdf"') do Set LIST=%i& set LIST | ren "%~fi" "%LIST:_= %"` – Murdoch Ripper Oct 30 '13 at 17:10

2 Answers2

1

It is really old software, but I use Lupas Rename 2000 to rename files in bulk. One of the rules you can use is "Replace text (_) with new text ( )".

It was last updated in 2005, but it is light, fast, and still works in Windows 7.

William Jackson
  • 8,344
  • 1
  • 37
  • 45
1

From the command line:

dir *.pdf /b | mawk "/ / { q=sprintf('%c',34); new=$0; gsub(/ /, '_', new ); print     'ren 'q$0q' 'new }"

This command will not do anything, but output the command about to be executed. To execute it, you just add cmd at the end:

dir *.pdf  /b  |  mawk  "/ / { q=sprintf('%c',34); new=$0; gsub(/ /, '_', new ); print 'ren 'q$0q' 'new }" | cmd

You can download mawk.exe from http://www.klabaster.com/freeware.htm#mawk

jftuga
  • 3,177
  • 1
  • 19
  • 23