Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

cavi

macrumors regular
Original poster
Sep 19, 2010
151
28
Haifa, Israel
Hi folkes,

I want to add to each file that created on the server's sherd folder a unique name and number. In another words, to each file added to folder X I want to add automatically to the file name a word and serial number. for example: If I created a file with the following name: "business plan", I want that when I save this file in server, the server automatically will add "- ATDocs-[serial number]" and the result will be (id there are already 3 files in the folder / subfolder): "business plan - ATDocs-004".
How can I do it?

Thanks!
A.
 

DJLC

macrumors 6502a
Jul 17, 2005
959
404
North Carolina
You could probably write an Automator action or shell script to do it, then schedule it with CRON. I'm not sure if you could do it on-the-fly as files are saved though.
 
  • Like
Reactions: cavi

Cineplex

macrumors 6502a
Jan 1, 2016
741
2,012
I think AppleScript and watched folders could work for this.
[doublepost=1469817499][/doublepost]You'd probably want a "spooler" folder that you saved something in. Then the script can sort it based on the criteria. Have the script look and see what file names exist and then name it based on that.
 
  • Like
Reactions: cavi and DJLC

cavi

macrumors regular
Original poster
Sep 19, 2010
151
28
Haifa, Israel
Thanks for your help! =]

Can you provide me more info about AppleScript? Or, if you have, give me a link to a site you recommend which contains some explanations about it?

Thanks!
 

Cineplex

macrumors 6502a
Jan 1, 2016
741
2,012
Thanks for your help! =]

Can you provide me more info about AppleScript? Or, if you have, give me a link to a site you recommend which contains some explanations about it?

Thanks!
Go here and ask these guys the same question (or search around the site). This is a very AppleScript specific forum and should be able to give you sample code. I am not up to date on the latest version of it so I don't want to give you bad advice.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.