Skip to main content
Geppetto Luis
Legend
October 8, 2019
Answered

Rename file

  • October 8, 2019
  • 3 replies
  • 1709 views

I would like to rename a file that is in this path
Applications / Adobe Photoshop CC 2018 / Presets / Scripts / text.jsx

this is the script

use mac ios
I don't know where the mistake is.

 

 

main();
function main(){
var doc  =  new File('~/Applications/Adobe Photoshop CC 2018/Presets/Scripts/test.jsx')
if(!doc.exists) return;

var Name = "test";
doc.rename(Name +  "_1.jsx");
}

 

This topic has been closed for replies.
Correct answer Test Screen Name

Is the file really in ~/Applications rather than /Applications? In fact shouldn't it be in ~/Library you are looking? 

 

Please try this in a command prompt. Type

 

ls "$HOME/Applications/Adobe Photoshop CC 2018/Presets/Scripts/test.jsx"

What do you see?

3 replies

Kukurykus
Legend
October 8, 2019

If I remember well, extendscript rename doesn't work for OSX.

Geppetto Luis
Legend
October 8, 2019
Kukurykus Ame is working well.
Test Screen NameCorrect answer
Legend
October 8, 2019

Is the file really in ~/Applications rather than /Applications? In fact shouldn't it be in ~/Library you are looking? 

 

Please try this in a command prompt. Type

 

ls "$HOME/Applications/Adobe Photoshop CC 2018/Presets/Scripts/test.jsx"

What do you see?

Geppetto Luis
Legend
October 8, 2019

It's working
thanks

JJMack
Community Expert
Community Expert
October 8, 2019

If rename does not work  you may need to test that "~/Applications/Adobe Photoshop CC 2018/Presets/Scripts/" + Name + "_1.jsx" does not exist. Copy '~/Applications/Adobe Photoshop CC 2018/Presets/Scripts/test.jsx' to
"~/Applications/Adobe Photoshop CC 2018/Presets/Scripts/" + Name + "_1.jsx"
then delete  remove file '~/Applications/Adobe Photoshop CC 2018/Presets/Scripts/test.jsx' 

JJMack
Geppetto Luis
Legend
October 8, 2019
JJMack I tried how you suggested but it doesn't work?