Skip to main content
Loic.Aigon
Legend
February 24, 2017
Answered

Mac files url to HFS path

  • February 24, 2017
  • 2 replies
  • 2585 views

Hi,

Does anyone of you knows to convert this:

"/Users/user/Desktop/myFile.ext"

into

"Macintosh HD:Users:user:Desktop:myFile.ext"

Starting from a File myFile.ext located on the desktop ?

I can do string concatenations and stuff or call applescript but I was looking at something more meaningful.

TIA

Loic

This topic has been closed for replies.
Correct answer TᴀW

Hi Loic,

How about:

f = new File(Folder.desktop + "/myFile.ext");

alert("Macintosh HD" + f.fsName.replace(/\//g, ":");

Ariel

2 replies

Participant
February 11, 2024

Use pathfinder - right-click on the folder and copy path as HFS .

TᴀW
TᴀWCorrect answer
Legend
February 24, 2017

Hi Loic,

How about:

f = new File(Folder.desktop + "/myFile.ext");

alert("Macintosh HD" + f.fsName.replace(/\//g, ":");

Ariel

id-extras.com | InDesign tools & scripts for typesetters, form designers, and translators
Loic.Aigon
Legend
February 24, 2017

Well I guess I will go with this one

Thx

Loic