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
How to get File Created Date from filesystem? [#18977 ]
Moderators: jiri, drakinite, Addon Administrators
Re: How to get File Created Date from filesystem?
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).
Tracking as https://www.ventismedia.com/mantis/view.php?id=18977 (to be added for the next 5.0.3 build).
Re: How to get File Created Date from filesystem? [#18977 ]
Should be available as of 5.0.3.2614+
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
How to attach PICTURE/SCREENSHOTS to forum posts
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
How to attach PICTURE/SCREENSHOTS to forum posts
Re: How to get File Created Date from filesystem? [#18977 ]
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.
Re: How to get File Created Date from filesystem? [#18977 ]
Hi,
It was our pleasure.
It was our pleasure.
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
How to attach PICTURE/SCREENSHOTS to forum posts
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
How to attach PICTURE/SCREENSHOTS to forum posts
-
- Posts: 1
- Joined: Sun Jul 10, 2022 9:19 am
Re: How to get File Created Date from filesystem? [#18977 ]
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
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 ]
Hi,
as stated here: https://www.mediamonkey.com/docs/api/cl ... eInfoAsync
it results JSON.
So use something like this:
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'));