Listing of contents in a .csv file

Hello, I'm trying to modify the following script so that I can produce a .csv from the files that I am getting a count for. Currently part of the list shows up in the launch of the batch job but I would like to get the full list in a .csv file. The script right now just gives me a count. Here is the code to modify:

@ECHO OFF

SETLOCAL 
SETLOCAL ENABLEDELAYEDEXPANSION

SET count=0 
for %%o IN (\\govnas03\TS_Alfresco_TABS\Shipment\*.*) DO ( 
      echo %%o 
      SET /A count=count + 1 
)

echo %count% > logfile.txt

IF "%count%"=="100" ECHO NET STOP MyApp

ENDLOCAL ENABLEDELAYEDEXPANSION 
ENDLOCAL
pause

Open in new window

DancingFighterGAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DancingFighterGAuthor Commented:
i believe that I found a partial script that will give me the following:

Fields:

File name (this can include commas!)
Creation date
Modified date

(FOR /f "delims=" %%a IN ('dir /b /a-d') DO (
    FOR /f "tokens=1-3*" %%x IN ('dir /a-d /tc "%%~a"^|findstr "^[0-9]"') DO (
        ECHO "%%a",%%~ta,%%x %%y %%z
    )
Bill PrewIT / Software Engineering ConsultantCommented:
What attributes of each file do you want included?

~bp
DancingFighterGAuthor Commented:
Now I just need to see how to apply this script to my current script
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

DancingFighterGAuthor Commented:
Hello Bill,

Currently the script is just getting the count from the location. I just want to grab the file names and place them in the .csv. Getting creation and modified date would be great if we can do it
Bill PrewIT / Software Engineering ConsultantCommented:
Give this a try, it should put the file name, time stamp, amd size in the CSV file you specify.

@ECHO OFF

SETLOCAL 
SETLOCAL ENABLEDELAYEDEXPANSION

set LogFile=logfile.txt
set CsvFile=csvfile.txt
if exist "%CsvFile%" del "%CsvFile%"

SET count=0 
for %%o IN (\\govnas03\TS_Alfresco_TABS\Shipment\*.*) DO ( 
      echo "%%~o","%%~to","%%~zo" >> "%CsvFile%"
      SET /A count=count + 1 
)

echo %count% > "%LogFile%"

IF "%count%"=="100" ECHO NET STOP MyApp

ENDLOCAL ENABLEDELAYEDEXPANSION 
ENDLOCAL
pause

Open in new window

~bp

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DancingFighterGAuthor Commented:
Works great. Thanks!!
Bill PrewIT / Software Engineering ConsultantCommented:
Great, glad that helped.

~bp
DancingFighterGAuthor Commented:
great quick solution!!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.