From: Warren Phillips on
Hi:

I get about 20 Veritas Backup Exex logs per day (from branch offies) that
arrive via email in "Unicode" format. I save these files (everyday) into a
folder on my hard drive.

These are *.txt files

I need a way to "mass convert" ALL these file (at one time) to an ANSI
format.

Right now, I have to open each file....one by one....and then "SAVE AS" ANSI
to get all of them into this format.

I could save "hours" per month if I could find a way to "automate" the
conversion of every UNICODE file (to ANSI) in a particular folder (ie say
C:\logs).

I would be VERY greateful to anyone who could give me a solution for this.
I am not a programmer....and have limited knowledge of using scripts, etc.....

Thank you very much.

Warren Phillips
From: William DePalo [MVP VC++] on
"Warren Phillips" <WarrenPhillips(a)discussions.microsoft.com> wrote in
message news:A8EA0C3A-66BE-4A6A-9A30-71C36E77D87B(a)microsoft.com...
> I get about 20 Veritas Backup Exex logs per day (from branch offies) that
> arrive via email in "Unicode" format. I save these files (everyday) into
> a
> folder on my hard drive.
>
> These are *.txt files
>
> I need a way to "mass convert" ALL these file (at one time) to an ANSI
> format.
> ...
> I would be VERY greateful to anyone who could give me a solution for this.
> I am not a programmer....and have limited knowledge of using scripts,
> etc.....

Well, as this is a developer group, this isn't the best group to post in.
Someone may have a link to a utility for you.

But the kind of advice this group is best at doling out would be to tell you
(assuming the logs aren't huge) to map the file into memory with
CreateFile(), CreateFileMapping() and MapViewOfSection(), call wcstombs() or
WideCharToMultiByte() to convert the data and WriteFile() to save it.

Regards,
Will
www.ivrforbeginners.com


From: Warren Phillips on
Thanks.....I struggled trying to figure out "which" group would be best
suited to POST this question......

If anyone has any ideas to point me in the right direction as far 'which"
group would be best for this....I would appreciate this as well

Thanks



"William DePalo [MVP VC++]" wrote:

> "Warren Phillips" <WarrenPhillips(a)discussions.microsoft.com> wrote in
> message news:A8EA0C3A-66BE-4A6A-9A30-71C36E77D87B(a)microsoft.com...
> > I get about 20 Veritas Backup Exex logs per day (from branch offies) that
> > arrive via email in "Unicode" format. I save these files (everyday) into
> > a
> > folder on my hard drive.
> >
> > These are *.txt files
> >
> > I need a way to "mass convert" ALL these file (at one time) to an ANSI
> > format.
> > ...
> > I would be VERY greateful to anyone who could give me a solution for this.
> > I am not a programmer....and have limited knowledge of using scripts,
> > etc.....
>
> Well, as this is a developer group, this isn't the best group to post in.
> Someone may have a link to a utility for you.
>
> But the kind of advice this group is best at doling out would be to tell you
> (assuming the logs aren't huge) to map the file into memory with
> CreateFile(), CreateFileMapping() and MapViewOfSection(), call wcstombs() or
> WideCharToMultiByte() to convert the data and WriteFile() to save it.
>
> Regards,
> Will
> www.ivrforbeginners.com
>
>
>
From: Alex Blekhman on
"Warren Phillips" wrote:
> I get about 20 Veritas Backup Exex logs per day (from
> branch offies) that
> arrive via email in "Unicode" format. I save these files
> (everyday) into a
> folder on my hard drive.
>
> These are *.txt files
>
> I need a way to "mass convert" ALL these file (at one
> time) to an ANSI
> format.


You can solve it using CMD batch script. On my XP Pro SP2
machine the `TYPE' command understands Unicode files just
fine. Here's small batch script I tested:

--- start of script ---

@echo off

if "%1"=="" goto :usage
if "%1"=="/?" goto :usage
if "%1"=="-?" goto :usage

pushd %1
for %%f in (*.txt) do call :convert "%%f"
popd
goto :eof

:convert
echo Converting %1 ...
type %1 > "%~n1.tmp"
del %1
ren "%~n1.tmp" %1
goto :eof

:usage
echo Converts all Unicode text files in given directory to
ANSI.
echo.
echo %~n0 directory
echo.
echo directory Specifies the directory to scan.

--- end of script ---

Copy the above text (except "---" delimiters) into Notepad
and save it as ".CMD" file. The script searches for .TXT
files. If you want to change it then fix the `for' command
or make extension string to be input parameter to the batch
file. Also, pay attention that the script deletes original
Unicode files.

HTH
Alex

From: Warren Phillips on
Thank you very much



"Alex Blekhman" wrote:

> "Warren Phillips" wrote:
> > I get about 20 Veritas Backup Exex logs per day (from
> > branch offies) that
> > arrive via email in "Unicode" format. I save these files
> > (everyday) into a
> > folder on my hard drive.
> >
> > These are *.txt files
> >
> > I need a way to "mass convert" ALL these file (at one
> > time) to an ANSI
> > format.
>
>
> You can solve it using CMD batch script. On my XP Pro SP2
> machine the `TYPE' command understands Unicode files just
> fine. Here's small batch script I tested:
>
> --- start of script ---
>
> @echo off
>
> if "%1"=="" goto :usage
> if "%1"=="/?" goto :usage
> if "%1"=="-?" goto :usage
>
> pushd %1
> for %%f in (*.txt) do call :convert "%%f"
> popd
> goto :eof
>
> :convert
> echo Converting %1 ...
> type %1 > "%~n1.tmp"
> del %1
> ren "%~n1.tmp" %1
> goto :eof
>
> :usage
> echo Converts all Unicode text files in given directory to
> ANSI.
> echo.
> echo %~n0 directory
> echo.
> echo directory Specifies the directory to scan.
>
> --- end of script ---
>
> Copy the above text (except "---" delimiters) into Notepad
> and save it as ".CMD" file. The script searches for .TXT
> files. If you want to change it then fix the `for' command
> or make extension string to be input parameter to the batch
> file. Also, pay attention that the script deletes original
> Unicode files.
>
> HTH
> Alex
>
>