Unique file name

Discussion in 'Mac OS X Server, Xserve, and Networking' started by cavi, Jul 29, 2016.

  1. cavi macrumors regular

    cavi

    Joined:
    Sep 19, 2010
    Location:
    Haifa, Israel
    #1
    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.
     
  2. DJLC macrumors 6502a

    DJLC

    Joined:
    Jul 17, 2005
    Location:
    Mooresville, NC
    #2
    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.
     
  3. Cineplex macrumors 6502a

    Cineplex

    Joined:
    Jan 1, 2016
    #3
    I think AppleScript and watched folders could work for this.
    --- Post Merged, Jul 29, 2016 ---
    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.
     
  4. cavi thread starter macrumors regular

    cavi

    Joined:
    Sep 19, 2010
    Location:
    Haifa, Israel
    #4
    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!
     
  5. Cineplex macrumors 6502a

    Cineplex

    Joined:
    Jan 1, 2016
    #5
    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.
     
  6. cavi thread starter macrumors regular

    cavi

    Joined:
    Sep 19, 2010
    Location:
    Haifa, Israel

Share This Page