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

Publicar una respuesta

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

BBCode está habilitado
[img] está habilitado
[url] está habilitado
Emoticonos están habilitados

Revisión de tema
   

Expandir vista Revisión de tema: How to get File Created Date from filesystem? [#18977 ]

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

por Ludek » Mié Ago 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:

Código: Seleccionar todo

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 ]

por milos2000milos » Jue Ago 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 ]

por Peke » Sab Abr 23, 2022 4:49 pm

Hi,
It was our pleasure.

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

por mms1234 » Sab Abr 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 ]

por Peke » Mié Abr 13, 2022 6:41 pm

Should be available as of 5.0.3.2614+

Re: How to get File Created Date from filesystem?

por Ludek » Lun Abr 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 ]

por mms1234 » Dom Abr 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

Arriba