Can't get integration to work!

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
PAB
Posts: 139
Joined: 12 Aug 2019 13:57

Can't get integration to work!

#1 Post by PAB » 30 Aug 2020 12:54

Good evening,

I have two lines of code which work individually . . .

Code: Select all

for /f "tokens=*" %%A in ('dir /b /a:-d') do echo %%~nxA %%~zA >> "Folders_Files.txt"

Code: Select all

dir /b /a:-d | findstr /v /i "Folders_Files.txt List_Folder_Files_1.bat" >> "Folders_Files.txt"
I have tried so many variations but I can't seem to get the two above lines into one line and work!

Thanks in advance.

EDIT1:

Cracked it . . .

Code: Select all

for /f "tokens=*" %%A in ('dir /b /a:-d ^| findstr /v /i "Folders_Files.txt List_Folder_Files_1.bat"') do echo %%~nxA %%~zA >> "Folders_Files.txt"
Is there anyway to show the %%~zA output as KB with a thousand separator please?
I am also going to try and work in a count for the number of files!

EDIT2:

Cracked the count part . . .

Code: Select all

set /a count=0
for /f "tokens=*" %%A in ('dir /b /a:-d ^| findstr /v /i "Folders_Files.txt List_Folder_Files_2.bat"') do (
  set /a count+=1
  echo %%~nxA %%~zA >> "Folders_Files.txt"
)
echo. >> "Folders_Files.txt" & echo Total files: %count% >> "Folders_Files.txt"

Post Reply