I have created a batch file to gather some information about different file locations and one is to get the size in bytes. I was wondering if there was a way to remove the comma as I am creating a .csv file and opening it in excel where the separator is a comma, therefore, I am unable to view the information under the correct headings.
Can this be done?
Here's my code for getting the size:
ECHO OFF
Set _size=0
For /F "tokens=3 delims= " %%I In ('Dir !folder! /a-d /S ^|Find /I "file(s^)"') Do Set size=%%I
Thanks!
Add /-c
to the DIR command as shown below.
It will remove the commas before they become a problem in the first place.
The escape character in the find command was not needed either.
@ECHO OFF
setlocal enabledelayedexpansion
Set size=0
For /F "tokens=3 delims= " %%I In ('Dir !folder! /a-d /S /-c ^|Find /I "file(s)"') Do Set size=%%I