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?
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
    )
0
Bill PrewCommented:
What attributes of each file do you want included?

~bp
0
DancingFighterGAuthor Commented:
Now I just need to see how to apply this script to my current script
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

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
0
Bill PrewCommented:
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
0

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!!
0
Bill PrewCommented:
Great, glad that helped.

~bp
0
DancingFighterGAuthor Commented:
great quick solution!!
0
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.