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

How to move files using app.system()?

Participant ,
Dec 08, 2016 Dec 08, 2016

Copy link to clipboard

Copied

I am trying to move a file from a location to, say, my desktop. How do I do this using app.system()?

 

I found this thread How do I move files through Extendscript? which has started me on the right path, but I don't know AppleScript. I did a bit of searching and put this together, which appears to do nothing (ExtendScript just says Result: 256):

 

app.system("osascript -e 'tell application \"finder\" move POSIX file \"/path/to/file.tif\" to POSIX file \"~/Desktop\" with replacing'");

 

What am I doing wrong here?

TOPICS
Actions and scripting

Views

5.6K

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

correct answers 1 Correct answer

Participant , Dec 09, 2016 Dec 09, 2016

Your script worked fine for me on MacOS Sierra

app.system("mv -f /Users/javier/Desktop/Delete/2016_12_09/image.jpg ~/Desktop");

If you have special characters or spaces, you will need to escape them with a "\\", like this:

app.system("mv -f /Users/javier/Desktop/Delete/2016\\ 12\\ 09/image.jpg ~/Desktop");

One of my folders is called "2016 12 09", so I have to escape those characters --> "2016\\ 12\\ 09"

You can also do it with osascript, like you initial code. You had a couple of errors, you were m

...

Votes

Translate

Translate
Adobe
Participant ,
Dec 15, 2016 Dec 15, 2016

Copy link to clipboard

Copied

I see. Yeah using getFiles on a network drive is not a good idea.

It is a shame that you can't retrieve the result from an app.system

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