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

Renaming and copying files (Bridge CS3)

New Here ,
Apr 12, 2011 Apr 12, 2011

Hi -- Scripting bridge, I am able to copy files using the copyTo(target) function.

I also can rename files using the Javascript file.rename() function.

But I am having trouble doing both in concert.

If I rename before I copy, I lose the reference to the selected thumb, and I cannot copy it.

I have tried using the Javascript file.copy() function with no success.

Does anyone have any suggestions how I can approach this problem?

thanks in advance

TOPICS
Scripting
936
Translate
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
Guide ,
Apr 12, 2011 Apr 12, 2011

Don't you just need to cancat the folder that you have as target and the thumbs name in a new file object?

#target bridge var thisFolder = Folder.desktop; var thisFile = app.document.selections[0]; if (thisFile.type == 'file') {      if (thisFile.copyTo(thisFolder)) {           var newFile = File(thisFolder.fsName + '/' + thisFile.name);           newFile.rename('SomeNewName');            } }

Translate
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
New Here ,
Apr 12, 2011 Apr 12, 2011

Hi -- Thanks -- that's what I needed.

... but I did run into one issue: The renaming of the file does not work when my target directory is a network location as opposed to a local folder. Is there a workaround for that?

thanks again for your assistance.

Translate
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
New Here ,
Apr 12, 2011 Apr 12, 2011
LATEST

Ahhh .. nevermind. I figured it out. No need for .fsName for network location.

thanks again

Translate
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