Showing the output of your excellent code is added value for new users.
It is much easier to follow the flow of the code when the output is provided.
I will continue to post the output of any code I please.
Don't allow the troublemakers through email distort my intentions or your intentions.
Keep posting. You are the best code man here.
I suspect you are still working in the real world.
When you say "here is the output from sw's code" make sure it is EXACTLY the same as the code he gave, otherwise, it's a <modified version> of sw's code. that is- state what you changed. Heck, maybe one of these days you might want to actually describe how the batch files work, since, as much as you'd like to say otherwise, a new user to batch doesn't instantly understand how your output translates to function, especially since output is, by definition, full of data specific to your test data.
I suspect you are still working in the real world.
Evidently, by the fact that you so strongly insist on "output" as some sort of measurement metric of code quality/correctness, you aren't- wether this is due to retirement, or other factors is redundant.
While it's true that showing output is certainly one of the many things one can do to display how a piece of code works, it is far from the only thing you should do. pasting a chunk of output from a cmd session lacks one thing: narration. In order to LEARN from the output, the person needs to understand what is happening. the output from cmd doesn't always reflect that, and due to various manglings that occur when the batch is run in with echo on (a reasonable setting when testing/debugging batch files), for example, double percent signs collapse to single percent signs, various other changed regarding delayed expansion (if used) etc.
additionally- the output from a single session only determines the correctness of code in one instance. If I had a batch file:
@echo off
echo 2
and claimed it did math, by your logic I could simply show the output!
C:\>test.bat 1+1
2
In other words- it proves correctness but only for a single set of input data; and since the input data(various files and folders, in the case of the batch solutions provided here) Is not necessarily the same as what you may have on your machine, it's not usually a very effective one.
Pre-emptive snarky comment "where is BC's code?" or some variant thereof:VBScript
dim fileread
fileread = WScript.Arguments(0)
set FSO = CreateObject("Scripting.FileSystemObject")
set ffile = FSO.GetFile(fileread)
set tstream = ffile.OpenAsTextStream(1,0)
strread = tstream.ReadAll()
strread = Replace(strread," ","")
tstream.close()
set ffile = nothing
set tstream = FSO.CreateTextFile(fileread,True,False)
tstream.Write strread
tstream.close