Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.
@echo offfor /f "delims==" %%i in ('dir /b *.txt') do (echo %%iecho %%i | wc -c
a-hire.txt 13bat.txt 10caavsetupLog.txt 19caisslog.txt 15myFILE.txt 13mymoney.txt 14ReadMe.txt 13savenow.txt 14savestr.txt 14teststr.txt 14tokens.txt 13unix.txt 11ver.txt 10x.txt 8xvar.txt 11xx.txt 9xxx.txt 10zzz.txt 10C:\>
Set objFS = CreateObject("Scripting.FileSystemObject")strFolder = "c:\test"Set objFolder = objFS.GetFolder(strFolder)For Each strFile In objFolder.Files WScript.Echo strFile.Name,Len(strFile.Name)Next
c:\test> cscript /nologo myscript.vbs
C:\test>cscript /nologo test.vbs11 MickeyMouse Road.doc 2311 MickeyMouse Road.pdf 23a-hire-1-0601-txt 17a-hire-2-0601-txt 17a1.csv 6a2.csv 6
import ospath=os.path.join("c:\\","test")os.chdir(path)for files in os.listdir("."): print files,len(files)
c:\test> python myscript.py
Ghost,Why does wc -c show 9 characters when there are only six?C:\>cat unix.txt666666C:\>cat unix.txt | wc -c 9C:\>
c:\test> od -c file.txt
C:\test>more file.txt666666C:\test>cat file.txt | wc -c <-------------------- No need to use cat .. see wc example below6C:\test>wc -c < file.txt6
@echo offecho 11 MickeyMouse Road.doc | wc -cecho 11 MickeyMouse Road.pdf | Wc -cecho a-hire-1-0601-tx | wc -cecho a-hire-2-0601-txt | wc -cecho a1.csv | wc -cecho wcup a2.csv | wc -l
25 25 19 19 8
C:\test>echo 11 MickeyMouse Road.doc | wc -c26C:\test>echo 11 MickeyMouse Road.doc | od -c0000000 1 1 M i c k e y M o u s e R0000020 o a d . d o c \r \n0000032
C:\test>echo testtest <---- extra blankC:\test>
C:\test>printf "11 MickeyMouse Road.doc" | wc -c23
Ghost,Hey, you are good. Do you work for Microsoft or AT&T?
I like these Unix solutions better than than the VBS solution. I hope the lady who started this thread is still reading. Thanks for the effort over and above . . .