How to get File Created Date from filesystem? [#18977 ]

Post a reply

Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: How to get File Created Date from filesystem? [#18977 ]

Re: How to get File Created Date from filesystem? [#18977 ]

by Ludek » Wed Aug 24, 2022 10:13 am

Hi,
as stated here: https://www.mediamonkey.com/docs/api/cl ... eInfoAsync
it results JSON.

So use something like this:

Code: Select all

async function getDateModified(path) {
   var jsonInfo = await app.filesystem.getFileInfoAsync(path);
   var info = JSON.parse(jsonInfo);
   return info.dateModified;
}
console.log( getDateModified('C:\\myFile.mp3'));

Re: How to get File Created Date from filesystem? [#18977 ]

by milos2000milos » Thu Aug 18, 2022 11:54 am

Hi, could anyone give me any pointers on how to get the datecreated from what ive written below?

var fileInfo = await app.filesystem.getFileInfoAsync(item.path);

Once i've got the file info into a variable, how do I extract the date created from that? I'm unfamiliar with the Promises class so I've been struggling to do this myself.
Thanks

Re: How to get File Created Date from filesystem? [#18977 ]

by Peke » Sat Apr 23, 2022 4:49 pm

Hi,
It was our pleasure.

Re: How to get File Created Date from filesystem? [#18977 ]

by mms1234 » Sat Apr 23, 2022 7:39 am

Just wanted to say thank you for adding this! I just tested on the beta build and it's working great. I was able to finish up that script I was working on. thanks so much for the quick turnaround on that. :D

Re: How to get File Created Date from filesystem? [#18977 ]

by Peke » Wed Apr 13, 2022 6:41 pm

Should be available as of 5.0.3.2614+

Re: How to get File Created Date from filesystem?

by Ludek » Mon Apr 11, 2022 5:55 am

Hi, thanks for feedback!

Tracking as https://www.ventismedia.com/mantis/view.php?id=18977 (to be added for the next 5.0.3 build).

How to get File Created Date from filesystem? [#18977 ]

by mms1234 » Sun Apr 10, 2022 4:35 pm

Anyone know if it is possible to retrieve the date a file was created on the file system? I looked in app.filesystem and it doesn't look like there are any functions there that I can use for that.

I am converting a MM4 Vb script that I would use occasionally to fix the "Date Added" value on some older tracks that I've had in different folders on my PC and added into MM5 well after they were created (like years later). So I'd like to update the MM DB "Date Added" to be the date the file was created, not the date it was actually added/imported into MM5 DB.

For reference, in VBScript I could get the file object:
Set f = fso.GetFile(song.Path)
and then get the date created from that:
song.DateAdded = f.DateCreated

Top