I have a bunch of files inside a folder that I want to get the Date Modified and Created from and copy it into a text document or some kind of tab delimited document. I have no idea how to do this.

Opening each one and manually copy/pasting the Creation Date is not an option, as this is hundreds of files.

Can this operation be automated or scripted?

EDIT: I found that using the following will give me all the various date formats and puts them in a txt file, and all dates preserved:

(stat -f "%N%tAccess:%t%Sa%tModify:%t%Sm%tChange:%t%Sc%tBirth:%t%SB" *)>creation.txt

However, when I then try to copy that information into an excel sheet, even though it keeps the days and times, all the years are changed to 2023.

txt file:

EXAMPLE.mp3 Access: Dec 9 11:48:21 2023 Modify: May 19 21:37:55 2020 Change: Dec 7 19:03:24 2023 Birth: Nov 26 06:07:58 2014

Pasted into excel spreadsheet:

EXAMPLE.mp3 Access: Saturday, December 9, 2023 Modify: Friday, May 19, 2023 Change: Thursday, December 7, 2023 Birth: Sunday, November 26, 2023

  • Could you take one sample file and show its full date with ls -l file.whatever and then hand edit the results to show us the date format you need? This will be fairly straightforward with tools like awk and ls - edit these in the question if possible so everyone can see the request in the body and not the comments
    – bmike
    Commented Dec 4, 2023 at 1:44

1 Answer 1


You could use the command given below. The results would be written to the file creation.txt.

(cd path;stat -f "%N%t%SB" *)>creation.txt

You should replace path with the path to the folder (including folder name) where the files are stored. For example, if the files are in a folder named My Files, which is in your Documents folder, then enter the following.

cd ~/Documents
(cd "My Files";stat -f "%N%t%SB" *)>creation.txt

The file creation.txt will be written to your Documents folder. To see the contents, enter the following command.

cat creation.txt

Example output is given below.

UserManual.pdf  Jan 12 08:02:21 2021
bye.txt Dec  3 21:19:35 2023
hi.txt  Dec  3 21:19:24 2023
something.bin   Dec  3 21:20:02 2023

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .