I want to process a batch operation in a big directory. Actually I have the batch script for that process. But here , I have a problem. Some of the directory names, files names contain ” ” (space character). So in the batch operation this names passed as 2 arguments . and those lines will not work. So Iwant to rename ” ” with “_” to overcome this problem .
Example:
process /MyDirectory/Ola and Me/Private/TopSecretPictures/
this gives error. the below one works fine
process /MyDirectory/Ola and Me/Private/TopSecretPictures
My aim is: convert | Ola and Me |>> |Ola_And_Me recursively
🙂
thanks in advance ..
The following script renames all files and directories recursively, starting at a given directory, converting spaces to underscores.
spaces_to_underscores.batsource:Usage:
Given this directory structure
it will rename the folder “
Ola and Me” to “Ola_and_Me“, and also rename any files such as “Photo 001.jpg” to “Photo_001.jpg“. The starting directory “My Directory” will not be renamed.WARNING: Do not run this script on standard windows directories, such as “
C:\Documents and Settings” or “C:\Program Files” or “My Documents” or “Application Data“. There is no “undo” functionality here. Make sure you have a backup.