Getting Data In

parse a text directory listing

tom2000i
New Member

How can I extract directory name,file name,file size, and modify time from a recursive directory list saved as a txt file. The challenge is to keep the direcory asociation with the files.

Tags (1)
0 Karma

tom2000i
New Member

The directory listing is pretty much identical to what you get with a "dir /s" command from a DOS shell but without the file count and Dir count summary at the end of each dir list.

0 Karma

sambosplunk
Engager

If on Windows:

dir /s /ON /B > dir.txt

This will include the file and path info on the same row.

0 Karma

tom2000i
New Member

OK but this does not show file size and modification date

0 Karma

Paolo_Prigione
Builder

It would be a real mess... Would it be possible for you to retrieve an "easier" recursive listing such as what provided from:

find folder_name -exec ls -l \{\}\;

This way file and path info would be stored on the same row.

0 Karma

Ayn
Legend

Well it would certainly help if you told us more about what the directory listing looks like and how you would like to separate it.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Introduction to Splunk AI

How are you using AI in Splunk? Whether you see AI as a threat or opportunity, AI is here to stay. Lucky for ...

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Maximizing the Value of Splunk ES 8.x

Splunk Enterprise Security (ES) continues to be a leader in the Gartner Magic Quadrant, reflecting its pivotal ...