1

I use this command in order to save the name of all the zip files under a directory, to a file.

find . -iname \*.zip > zipfiles.txt

How can I also include the creation date of the files?

Now the contents of zipfiles.txt are:

/dir/file1.zip 
/dir2/file2.zip

I want to include the creation date so something like this:

/dir/file1.zip 1/1/2019 13:15:23
/dir2/file2.zip 1/2/2018 23:55:53
5
  • 1
    @GAD3R I dont want to append it to the filename, but next to each filename in the txt file. Please check updated post Commented Oct 4, 2019 at 11:03
  • 2
    By creation time, do you mean the inode birth time (when the file came into existence), or the last modification time (when the content of the file was fully created)? Commented Oct 4, 2019 at 11:11
  • @StéphaneChazelas I want the date that the file was created Commented Oct 4, 2019 at 11:12
  • that is not answering my question. What do you consider the time the file is created? When it appeared or when it was fully created? Commented Oct 4, 2019 at 11:14
  • @StéphaneChazelas I dont fully understand the difference between them... But I guess it doesn't matter much so I will need the Last modification time Commented Oct 4, 2019 at 11:18

2 Answers 2

3

Try this,

 find . -iname '*.zip' -printf '%p %TY/%Tm/%Td %.8TT\n' > zipfiles.txt
2

With the GNU implementation of find, you can do:

find . -iname '*.zip' -printf '%p %TFT%TT%Tz+\n'

which gives an output like:

./file.zip 2018-03-04T13:23:21.0321012380+0000
1
  • I want to export this information in the zipfiles.txt file, next to each zip file name Commented Oct 4, 2019 at 11:20

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.