0

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?

Edited by dwlamb: Fix typos

2
Contributors
1
Reply
2
Views
4 Years
Discussion Span
Last Post by L7Sqr
0

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.