DosTips.com

A Forum all about DOS Batch
It is currently 22 Jul 2017 18:49

All times are UTC-06:00




Post new topic  Reply to topic  [ 3 posts ] 
Author Message
 Post subject: populate csv
PostPosted: 29 Jan 2017 17:41 
Offline

Joined: 29 Jan 2017 17:36
Posts: 2
I am using the following script to populate a csv file.

What do I need to change so the script will add filename+extension?

Right now only writes the filename.



Code: Select all
for %%a in (*.csv) do call :addID "%%~Na" "%%a"

goto :EOF

:addId
@echo off
for /f "usebackq delims=" %%b in (%2) do (
  > #.csv echo %%b
  goto :next
)
for /r %F in (*.*) do @echo %~nxF > %filename%
:next
for /f "usebackq skip=1 delims=" %%b in (%2) do (

  >> #.csv echo objects/%filename%,%filename%,%DATE%%%b
)
move #.csv %2


Last edited by aGerman on 29 Jan 2017 17:52, edited 1 time in total.
Please use code formatting


Top
   
 Post subject: Re: populate csv
PostPosted: 29 Jan 2017 20:09 
Offline
Expert

Joined: 23 Dec 2011 13:59
Posts: 3507
I saw this over on stack over flow as well and I am not really understanding what you are trying to do. You never set the variable %filename% in your code and I have no idea why you are breaking out of the FOR command after you CALL your label.


Top
   
 Post subject: Re: populate csv
PostPosted: 30 Jan 2017 07:16 
Offline

Joined: 29 Jan 2017 17:36
Posts: 2
Thanks for your reply.

The batch executes the following command on line 11:
for /r %F in (*.pdf) do @echo %%~nxF > %filename%

If I run same command inside folder I get:

for /r %F in (*.*) do @echo %~nxF
AROLDOALMEIDA2014.pdf

But when the batch writes into the csv it only writes AROLDOALMEIDA2014

Makes sense?


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 3 posts ] 

All times are UTC-06:00


Who is online

Users browsing this forum: Bing [Bot] and 16 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Limited