I am trying to write a script that will facilitate cataloguing various files on a backup medium. Looking at what's available, only stat seems suitable but it outputs the data with a lot of formatting I don't require and would take a lot of scripting to massage into what I want. ls -l at the CLI would result in a lot of scripting as well.

There are four pieces of information I need and would like them somehow delimited for easy import to a spreadsheet. In order they are:

File creation date and time to the minute
File size
File name
Label of the medium (DVD name)

I had developed a way to do this in Windows using JPSoft and found it a lot simpler than what it will take in bash.

Is there something other than stat and ls?

man stat would help.
Something like stat -c "%y|%s|%n" would get you close but there is no such thing as creation time in linux (looking around the net I see something called birthtime but I've not seen that supported widely). As far as the label of the medium, I'm not sure what flag would give you that or if you would have to use another program.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.