You are not logged in.

#1 27 Apr 2020 21:44

Sean-one-of-Qu
New Member
Registered: 27 Apr 2020
Posts: 1

Redirecting and in the process modifying the output of DIR, a question

Hi. Under windows and using the command line I want to send the output of a DIR command to a .csv file, e.g. F:\folder_one>DIR > output.csv .
However, for each file in "folder_one", I want or need ONLY the date e.g. dd/mm/yyyy, and the filename e.g. filename.xyz sent to output.csv . Using the /-c switch does not help.
I also want/need the date to be written to the csv as a number not as text.

I recollect being able to do this (20 years or so ago) under linux, as a one liner, by possibly splitting the "fields" in the output of the ls? command in, possibly, a print command and specifying which bits of the fields were to be written to the output file.

Currently each line of the output.csv contains 3 cells, these contain
cell A) dd/mm/yyyy      hh:mm      size-part-one
cell B) size-part-two
cell C) size-part-three      fliename.xya
e.g. A=(13/06/2019  11:11         1)     B=(212)        C=(416 filename.xyz) Size being =1,212,416


Unfortunately "cell A" is seen as containing text rather than a number and I need it as a number(date) in the subsequent spreadsheet.
I don't seem able to convert text to a number in the spread sheet programme.
Any suggestions and thanks

Offline

#2 29 Aug 2020 18:47

mikeyww
Member
Registered: 29 Aug 2020
Posts: 5

Re: Redirecting and in the process modifying the output of DIR, a question

If your date string contains slashes, then it is not a number. You can convert it to a numeric Julian date with additional code.

Offline

Board footer

Powered by