Want to remove those annoying ” ” blanks people put in their file names on Windows?

Here’s a DOS command to replace ” ” with “-“.

WARNING I do not guarantee this will work for you – please test it on a set of files you don’t care about – it works for me. Changes all files in the sub-directory – does not traverse the entire sub-dir tree – I don’t believe.

This example changes ” ” to “-” for all files in the sub-dir that end in “.ipynb” which is typically the Jupyter Notebook extension

cmd /e:on /v:on /c "for %f in ("* *.ipynb") do (set "n=%~nxf" & set "n=!n: =-!" & ren "%~ff" "!n!" )"

Leave a Comment

Scroll to Top