Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I use Cmd+L to make a alias, and the alias has "alia" appended to the original file name. I move the link to a directory, then remove the "alias" part manually.

Is there a tool that can do this kind of automatically? I mean, if a tool can catch the event a file is copied to a specific directory to call a tool (python, ruby or applescript) with a parameter, I can easily rename the file name.

ADDED

Thanks to Ben and Dori, I could get it working.

  1. Go to /Library/Scripts/Folder Actions directory to Folder Actions Setup.
  2. Run Automator
  3. Utilities -> Run Shell Script
  4. Use python as a shell, and pass input should be as arguments
  5. Run the following code
import sys
import os

for f in sys.argv[1:]:
    (name, ext) = os.path.splitext(f)
    newname = "%s%s" % (name, ".pdf")
    os.rename(f, newname)

Philip's method should work, but I think Automator is easier to get it work. On my Snow Leopard, I couldn't see the folder action context menu.

share|improve this question
add comment

2 Answers 2

up vote 3 down vote accepted

In addition to Applescript, Automator allows you to create Folder Actions as well, at least in 10.6. (This should have been a comment on Philip's post, but I don't quite have enough rep for that yet.)

share|improve this answer
    
+1 Automator might be the easier of the two ways to do this. I don't use it because my daily needs are for more advanced and I sometimes forget it even exists. –  Philip Regan Oct 7 '10 at 19:22
add comment

I'm not sure what you're using to make symbolic links (it's not built in to OS X), so I can't say if something could be added at that step.

For Folder Actions, the three places to look are:

  • /Library/Scripts/Folder Actions
  • /Library/Scripts/Folder Action Scripts
  • /Library/Scripts/Script Editor Scripts/Folder Actions Handlers

In the first folder, you'll find Configure Folder Actions - run that, and you can enable folder actions, including choosing folders and what scripts apply to those folders.

The last two folders will give you some places to start writing the script you want.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.