Script for folder or file that always has a name that is the CURRENT DATE

hi all,
i tried to get this done a couple times and i either misunderstood how to use the script or there was some complication so i am returning to it. i would like to have a FILE or a FOLDER on my desktop that has a name which is TODAYS DATE.
the reason i need this:
i am using carbon copy cloner and when i plug in an external hard drive it runs a backup. i would like to make sure that the backup is /current/ and right now short of looking for a file that is new on my hard drive and then finding the same file on the backup i am not sure how to do this. i suppose there may be a way to do it in CCC but i would prefer something right in the backup. i need this for Lion and Mountain Lion.
any ideas?

This answer on Stackoverflow may do what you want. It's worth repeating the warning:
You can obtain information about the file's modification date and time in a batch script, but you'll need to remember these things:
it comes as a combination of date and time;
it's locale specific;
it's a string.
Jason Warren
@jaspnwarren
jasonwarren.ca
habaneroconsulting.com/Insights

Similar Messages

  • Script for emailing multiple file types?

    Is there a script that will allow me to place a button on a form, that when clicked, will email the completed form in PDF format as well as in csv, or xml format?
    Thanks!

    Wow, thanks. That was extremely helpful, but I have a couple questions.
    First, is there a way to make it print to CUPS without opening the default application for the particular file first? For example, I used a .docx file, and it had to open microsoft word to send the job the print. This makers it very unpredictable to decide how much time the automator application will need to pause. If that file were for example, and adobe illustrator file, it would take an incredible amount of time just for illustrator to open. I don't really anticipate needing to do this a whole lot with anything other than text files and standard image types, but is that the only way for those other files to print? I figured that since OS 10.6 can do a quick look preview on just about any file type I use, that the OS would be able to do this without the application actually opening, but it seems not to be the case. Just wondering.
    The other issue is the only real problem, and it's one that I have had whenever I use automator to make PDFs. It always duplicates the job. So, I am getting a combined pdf, but it has the same file in there 2 or even 3 times.
    In automator, I used:
    get selected finder items
    then
    print finder items
    I have verified that it is printing everything multiple times because I see them going into the CUPS folder twice. Then, the final PDF sometimes even has the same doc or image in it 3 times. I have always had this problem with automator and PDFs, any idea how to solve that?
    Other than that duplication issue, this seems like it will work perfectly! Thanks for the reply here!

  • A script for adding the current date to file name?

    I am working in Indesign CS3. I frequently save file as PDFs into a designated folder. I was hoping for help in writing a script that would apply the current date to the end of the file name, when saved into this folder. Some days, I save the same file several times, into this folder. I was also hoping there was a way to add a date and version, for example "filename_2.25.11(1).pdf" Is this possible? Can someone help me?

    ok, I ended up with this test routine:
    on adding folder items to this_folder after receiving added_items
    tell application "Finder"
    repeat with this in added_items
    my checkifopened(this)
    display dialog (name of this) as text
    end repeat
    end tell
    end adding folder items to
    on checkifopened(this)
    set a to POSIX path of (this as alias)
    repeat until 1 = 0
    ## don't like that one because it relies on an error msg ... so
    (** try
    set b to do shell script "lsof | grep " & quoted form of a
    on error
    exit repeat
    end try**)
    ##so I use this one
    set b to do shell script "lsof"
    if b does not contain a then
    exit repeat
    else
    say "still opened"
    end if
    end repeat
    end checkifopened
    this is a folder action that tests if the added file is still opened by an application... there is no delay between each test-loop since lsof takes some time to execute...
    And after adding a timeout (just in case) to this function the final script looks like this:
    on adding folder items to thefolder after receiving added_items
    tell application "Finder"
    set folderkind to kind of thefolder
    set myfiles to every item of thefolder whose name does not contain "#" and kind is not folderkind
    repeat with myfile in myfiles
    set myfile_datestring to my get_datestring(creation date of myfile)
    set myfilename to name of myfile
    if (count of every character of myfilename) > 4 and (character -4 of myfilename) as text is "." then
    set filestatus to my checkifopened(myfile, 60)
    if filestatus = false then
    display dialog "timeout on folder action"
    else
    set tmp to ((characters 1 through -5 of myfilename) & "#" & myfile_datestring & (characters -4 through -1 of myfilename)) as text
    set myfilename to my checknamewith_pdfsuffix(tmp, thefolder, false)
    set name of myfile to myfilename
    end if
    end if
    end repeat
    end tell
    end adding folder items to
    on get_datestring(mydate)
    return year of mydate & "-" & (characters -2 through -1 of (("0" & (month of mydate as integer)) as text)) & "-" & (characters -2 through -1 of (("0" & (day of mydate as integer)) as text)) as text
    end get_datestring
    on checknamewith_pdfsuffix(n, D, looped)
    --check if filename exists in D
    -- so if "A File.pdf" exists it names it "A File 1.pdf","A File 2.pdf",...
    #n = string of the filename
    #D = file reference to the directory to check
    #looped = boolean used for recursive loop...
    tell application "Finder"
    set thefiles to name of every item of (D as alias)
    end tell
    if thefiles contains n then
    if looped = false then
    set n to ((characters 1 through -5 of n) & "(1)" & (characters -4 through -1 of n)) as text
    my checknamewith_pdfsuffix(n, D, true)
    else
    set tmp to (last word of ((characters 1 through -5 of n) as text) as integer)
    set tmpcount to (count of characters of (tmp as text)) + 5
    set tmp to tmp + 1
    set n to ((characters 1 through (-1 * tmpcount) of n) & "(" & tmp & ")" & (characters -4 through -1 of n)) as text
    my checknamewith_pdfsuffix(n, D, true)
    end if
    else
    return n
    end if
    end checknamewith_pdfsuffix
    on checkifopened(this, mytimeout)
    ## this file reference
    ## timeout in seconds
    set a to POSIX path of (this as alias)
    set startdate to current date
    repeat until 1 = 0
    ## don't like that one because it relies on an error msg ... so
    (** try
    set b to do shell script "lsof | grep " & quoted form of a
    on error
    exit repeat
    end try**)
    ##so I use this one
    set b to do shell script "lsof"
    if b does not contain a then
    return true
    else if ((current date) - startdate) > mytimeout then
    return false
    else
    ##say "still opened"
    end if
    end repeat
    end checkifopened
    to use this save this script in /Library/Scripts/Folder Action Scripts
    and add this as a folder action to your folder...
    The script processes all files inside that folder each time a new files is added...

  • How can I script a Flash .exe file to always stay on top of all other windows?

    Hi All,
    I'm new to action script, and I just need this one script
    > How can I script a Flash .exe file to always stay on top of
    all other windows?
    Basically what i want to do is have a flash-created
    step-by-step instructional movie, but for the movie to remain on
    top of all windows so the instructee is able to follow the
    instructions on-screen...
    It would be preferable to not have to buy another product
    just to do this... as I said, this is the only scripting I need.
    Thanks in advance
    Cheers
    Rick

    if you create your exe with mProjector you can use one of its
    new AS
    commands to do this.
    setZOrder
    http://www.screentime.com/software/mprojector/docs/mWin_setZOrder.htm
    all APIS
    http://www.screentime.com/software/mprojector/docs/index.html
    Demo
    http://www.screentime.com/software/mprojector/demo.html
    mProjector installs new classes and help into Flash, to
    enable them you
    must build your app with mProjector (its input is your swf)
    John Pattenden
    Screentime Media - Flash Tools since 1997
    http://www.screentime.com

  • HT5312 forgot answers for security questions, my apple account has updated email address but the rescue email address  for account is old and not accessible - do not know how to update that address so i can authorize new devices...

    forgot answers for security questions, my apple account has updated email address but the rescue email address  for account is old and not accessible - do not know how to update that address so i can authorize new devices...

    Welcome to the Apple Community.
    Start here (change country if necessary) and navigate to 'Password and Security', reset your security questions using the link provided, you will receive an email to your rescue address, use the link in the email and reset your security questions.
    If that doesn't help, you don't receive a reset email or you don't have a rescue address, you should contact AppleCare who will initially try to assist you with a reset email or if unsuccessful will pass you to the security team to reset your security questions for you.
    If you are in a region that doesn't have international telephone support try contacting Apple throughiTunes Store Support.

  • ICal on my Macbook has always grayed the current date. iCal on my MacMini (both 10.5.8) never has until a few days ago but has since stopped. How can I get it to "shade" again?

    iCal on my Macbook has always grayed the current date. iCal on my MacMini (both 10.5.8) never has until a few days ago but has since stopped. How can I get it to "shade" again?

    At this point I think you should get Applejack...
    http://www.macupdate.com/info.php/id/15667/applejack
    After installing, reboot holding down CMD+s, (+s), then when the DOS like prompt shows, type in...
    applejack AUTO
    Then let it do all 6 of it's things.
    At least it'll eliminate some questions if it doesn't fix it.
    The 6 things it does are...
    Correct any Disk problems.
    Repair Permissions.
    Clear out Cache Files.
    Repair/check several plist files.
    Dump the VM files for a fresh start.
    Trash old Log files.
    First reboot will be slower, sometimes 2 or 3 restarts will be required for full benefit... my guess is files relying upon other files relying upon other files! :-)
    Disconnect the USB cable from any Uninterruptible Power Supply so the system doesn't shut down in the middle of the process.

  • In Firefox 4 how can I cause the date on downloaded files to be the current date? (Some are and some are not. In FF3 the dates were ALWAYS the current ones.)

    In Firefox 4 how can I cause the date on downloaded files to be the current date? (Some are and some are not. In FF3 the dates were ALWAYS the current ones.)
    == This happened ==
    Every time Firefox opened
    == I upgraded to Firefox 4 (beta)

    Firefox 3.6.* and earlier set the downloaded file's modification time to the current time. In Firefox 4.0 the behavior has been changed, if a server returns a timestamp telling when the file was last modified (Last-Modified header), it is used instead.
    You can revert to the previous behaviour by using the [https://addons.mozilla.org/en-US/firefox/addon/93121/ Download Timestamp] add-on.

  • I am facing issue when opening flash files in Flash CC. (error:- This file was created with a later release of Flash Professional and might contain new features that would be lost when saved in the current format.)

    I am facing issue when opening flash files in Flash CC. (error:- This file was created with a later release of Flash Professional and might contain new features that would be lost when saved in the current format.)

    Wow. Okay...
    I'll let the real veterans in this forum tackle your issues one after the other. But, I can tell you, all will be well.
    My only comment would be re: your computer specs:
    BJReis wrote:
    .  This may be due to somewhat older equipment:
    GHz Intel Core Duo MacBook Pro with a 4GB memory computer with Ddr3 running OSX 10.8.4
    To be completely honest, FCPX is a RAM hog. It just is. But, RAM is relatively cheap, and the pay-off is good.
    4GB is right on the edge, IMHO. 16G is ideal.
    I wish you luck, hang in there, and standby for more help.

  • HT1349 I am trying to download the new version of itunes and it is stating that it has an invalid signature and the downloan has been removed.  How can I download it or get the signature?

    I am trying to download the new version of itunes and it is stating that it has an invalid signature and the downloan has been removed.  How can I download it or get the signature?

    Try the following user tip:
    Troubleshooting issues with iTunes for Windows updates

  • My MacBook will not turn on unless it's connected to a charger. However, when it's on and charging, it says that it has 0% battery life despite the green light on the charger. How can I fix this?

    My MacBook will not turn on unless it's connected to a charger/power source. However, when it is on and charging, it says that it has 0% battery life despite the green light on the charger. How can I fix this?

    Your battery has reached the end of its life. If you have a MacBook with the removable battery you can get a new third party battery fairly cheap on eBay.
    Black Batteries http://shop.ebay.com/i.html?_nkw=macbook+black+battery&_sacat=0&LH_BIN=1&_sop=12   &_dmpt=Laptop_Batteries&_odkw=macbook+white+battery&_osacat=0&_trksid=p3286.c0. m 270.l1313
    White Batteries http://shop.ebay.com/i.html?_nkw=macbook+white+battery&_sacat=0&LH_BIN=1&_sop=12   &_dmpt=Laptop_Batteries&_odkw=macbook+black+battery&_osacat=0&_trksid=p3286.c0. m 270.l1313
      Or for $129 from Apple http://store.apple.com/us/product/MA566LL/A?mco=MTY3ODQ5OTY

  • Why is showing the message that  Photoshop has stopped working? Then the program closes alone

    Why is showing the message that  Photoshop has stopped working? Then the program closes alone
    I bought the program today and does't work

    These questions below may be for a different product... but the KIND of information you need to supply is the same, for the products you use
    More information needed for someone to help... please click below and provide the requested information
    -Premiere Pro Video Editing Information FAQ http://forums.adobe.com/message/4200840

  • My book package validated, and delivered, but after several days, I have not been notified that Apple has it, or that it is in the iBooks store. When can I expect to hear something?

    My book package validated, and delivered, but after several days, I have not been notified that Apple has it, or that it is in the iBooks store. When can I expect to hear something?

    Did you check in iTunes Producer if your package really imported correctly?
    While in iTunes Producer, you go to "File" and then click on "Package History", it will fetch the status on the Apple system on-line.
    I have the same problem since I have been trying to update my previsously published book, I keep getting import error messages. I tried omitting the version number and "whats new in this version" but nothing seems to work... Sent emails to Apple through the iTunes producer tool but to no avail - so far.

  • I just restored my ipod as a new ipod and it won't let me sign in with my apple ID and says that it has an error connecting to the server, when I am already connected to the wifi.

    I just restored my ipod as a new ipod. It will not let me sign in with my apple ID and says that it has a problem connecting with the server, even though I am already connected to the wifi.

    Yes, of course.   Did you set up with your Apple ID?    
    Reset the iPad to factory and set it up with your Apple ID and password.   You can still sync different apps, music and other stuff onto the iPad,  the devices need not mirror each other.
    I have an old wifi iPad, an iPod touch and a new iPad mini with cellular.   All on the same Apple ID and password, different content on some apps, same on others.

  • TS1373 my  5th generation ipod acts like it is going to sync and then "ejects" itself before even 1 song can be synced. It then doesnt recognize that it has been ejected and keeps the"do not disconnect" icon on the screen even after unplugging. What do I

    my  5th generation ipod acts like it is going to sync and then "ejects" itself before even 1 song can be synced. It then doesnt recognize that it has been ejected and keeps the"do not disconnect" icon on the screen even after unplugging. What do I do?  it also makes a lot of noise while connected to the computer.

    Is the camera damaged? Could be a hardware problem.
    Try:
    Close the Camera app in the multitasking bar, then try again.
    Restart/Reset/Restore your iPod. In that order.

  • Variant "_$$audit-event-count" has not been declared in the current scope.

    I migrated my bpel process manager from Version 2.1.2 [oc4j linux] to 10.1.2.0.0 [using jboss as application server].
    The orabpel schema for 10.1.2.0.0 seems to be a bit different.
    I installed the new schema and then dumped all the data from my previous schema. I also successfully deployed the 2.1.2 processes onto 10.1.2 version.
    I can initiate a new instance of the process, however , the previously completed instances or not completed instances fail with the following error,
    16:28:06,061 INFO [STDOUT] <2006-01-31 16:28:06,061> <ERROR> <default.collaxa.cube> <BaseCubeSessionBean::logError> Error while invoking bean "instance manager": Variant not found.
    The variant "_$$audit-event-count" has not been declared in the current scope. All variants must be declared in the scope before being accessed.
    Any advice is greatly appreciated. Thanks.

    JScript is JavaScript.
    Ah, now there's part of the confusion :)
    If you're asking about a Windows Script Host (WSH) script, you don't have to declare stdin because it's part of the host.
    Ok... So if I understand you correctly, I'm actually programming in J(ava)Script on windows for WSH. Simply trying to call ReadLine fails as well, as it is not defined according to the compiler.
    Be specific: What are you trying to do? Tell what you want to do, not
    how you think it needs to be done.
    which brings me to my current issue: attempting to ReadLine() (in order to get the program to pause for a moment, from
    this example)
    I know I put up a pretty big wall of text back there, sorry about that.
    EDIT: Well, I think I've learned
    about J*script. It sounds like JScript and Javascript are more just versions of ECMAScript.

Maybe you are looking for

  • Z condition type for surcharge need to be displayed in billing doc only.

    Hi , I am having going to create condition type for surcharge, this condition type need to be diplayed only in billing doc.condition value should be calculated based weight of the material in delivery doc and scales in condition record. scales values

  • GW8 and MS Office 2010

    Our company recently send an emergency alert notice to all of our customers via email (GW8) Total sent was approx 17K emails. I have received approx 4K in returns for bad email address. My question is this: Is there a way to extract/export all of the

  • Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.

    Trying to get an admin type report working from the server.  Works fine when I run it from BIDS since I have all the associated permissions.  The report connects to multiple databases on different servers.  The servers have links between them, that i

  • WebDynpro - iview - different backend systems ?!?

    Hi all, confusion again ... I have the following situation. I developed a simple Web Dynpro application calling a bapi and deployed it to my Portal (host netweaver). During design time/rfc-model creation i used 2 JCO Connections: wd_modeldata_dest an

  • I need software that enables me to switch between different modes/profiles on my Mac

    I need software the allows me to switch between modes with a click on my computer. For example: Mode 1:      Disables the screen saver                   Changes power settings                   Changes the wallpaper Mode 2:      Sets everything to st