Applescript to rename files on external drive

Discussion in 'Mac Programming' started by wesg, Nov 7, 2008.

  1. wesg macrumors regular

    wesg

    Joined:
    Jan 2, 2008
    Location:
    Toronto, ON
    #1
    I wrote an applescript that does everything i want on the startup drive. It takes the selected files, processes them, and renames them. But so far, I have not been able to get it working on my external drive.

    I believe it has something to do with the path. On the internal startup drive, I used a path like "Macintosh HD:Users:username:desktop:file.txt" and it works fine.

    How can I use this on the external drive? Using "Volumes:Hard Drive:Files:file.txt" doesn't work. neither does replacing the : with /. Any suggestions?
     
  2. HiRez macrumors 603

    HiRez

    Joined:
    Jan 6, 2004
    Location:
    Western US
    #2
    Have you tried using / (starting with /Volumes) and declaring it as a "POSIX path"? As a test you might use a choose file dialog, choose the file on the external drive, and see what path it returns.
     
  3. wesg thread starter macrumors regular

    wesg

    Joined:
    Jan 2, 2008
    Location:
    Toronto, ON
    #3
    Way to go, HiRez, you did it!

    Once I did the choose file dialog, I found out that the path doesn't even use /Volumes/. I removed that from the file path in the script, and bingo, problem solved.

    Thanks!
     

Share This Page