Skip to main content
BurtleEd
Known Participant
March 17, 2010
Answered

Renaming a file to date and time after unziped

  • March 17, 2010
  • 1 reply
  • 507 views

I have a google earth kmz that is downloaded to our root directory. I am wanting to see how to rename this file after it is droped into our directory. Here is what I have so far.

<cfif FileExists("#expandpath(".")#/temp.zip")>
Got it .... extract....<br />
    <cfzip action="unzip" file="#expandpath(".")#/temp.zip"
    destination="#expandpath(".")#"
    overwrite="true">
    </cfzip>

Right now the code above unzips the file and places the KMZ in the root drive. I wanted to rename the file the current  date like as follows RT_2010_03_17_12_00.kmz

I have no idea how to accomplish this.

    This topic has been closed for replies.
    Correct answer ilssac

    <cfdirectory...> would probably help you find what the dynamic name of the file is.

    dateformat() should help you create a date string in the desired format to use to rename the file.

    1 reply

    ilssac
    Inspiring
    March 17, 2010

    The <cffile action="rename"...> is what I would look at using.

    http://livedocs.adobe.com/coldfusion/8/htmldocs/Tags_f_09.html#1098668

    BurtleEd
    BurtleEdAuthor
    Known Participant
    March 17, 2010

    Yep, I guess I don't know where to place the code and what to change to make it change to a date/time/year file because it errors out. Right now I cannot even get it to chage its name. The file comes in an it has a unique name.

    ilssac
    ilssacCorrect answer
    Inspiring
    March 17, 2010

    <cfdirectory...> would probably help you find what the dynamic name of the file is.

    dateformat() should help you create a date string in the desired format to use to rename the file.