• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

file.modified always returns null

Explorer ,
Jun 30, 2022 Jun 30, 2022

Copy link to clipboard

Copied

No matter what I do, I always have the modified returned as null. I am trying to get the modified date of two different files, and if the file is older then then server version it replaces the the older one with the new one. (Making something to update all our team scripts instead of me sending out a new JSX file and instructions each time)

 

here is the super simple code I am using to test though

 

var myFile = File ("~/Desktop/Test.png")
$.writeln("Is File: " + String(myFile instanceof File))
$.writeln("Exist: " + String(myFile.exists))
$.writeln("modified: " + String(File( myFile).modified));
 
and my results are
Is File: true
Exist: true
modified: null
 
any idea why its doesnt think its a file?
TOPICS
Scripting , Tools

Views

246

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Jun 30, 2022 Jun 30, 2022

Copy link to clipboard

Copied

I used 

$.writeln("modified: " + myFile.modified);

 

Is File: true
Exist: true
modified: Fri Apr 02 2021 19:09:24 GMT-0700

 

but your script also worked as is

 

(I'm on Windows)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jul 01, 2022 Jul 01, 2022

Copy link to clipboard

Copied

I tried this on my Mac and it returns null. I even checked the file properties in the VS Code debugger and both `created` and `modified` are null.  I set a file as a var and also picked a file using `openDialog()` and got the same results. Seems, it may be implemented on Windows but not on Mac.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 01, 2022 Jul 01, 2022

Copy link to clipboard

Copied

LATEST

or perhaps Mac changed their file system again

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines