Skip to main content
Known Participant
August 21, 2009
Question

Cffile rename ...

  • August 21, 2009
  • 2 replies
  • 1716 views

<cfset time = #DateFormat(now(), "mm/dd/yyyy hh:mm:ss")#>
<cfset ufile = #FORM.name#>
<cfset final = ufile&""&time>


<cffile action="RENAME" source="#ExpandPath('..\original\#filename#')#" destination= "#ExpandPath('..#final#.txt')#">

I am trying to rename file dynamically with using time and name from form but it not working

    This topic has been closed for replies.

    2 replies

    Inspiring
    September 10, 2009

    I am trying to rename file dynamically with using time and name from form but it not working

    What do you mean by "not working"?

    <cffile action="RENAME" source="#ExpandPath('..\original\#filename#')#" destination= "#ExpandPath('..#final#.txt')#">

    Do the source and destintations resolve to the values you expect them to?  Your destination path doesn't look right to me.

    --

    Adam

    BKBK
    Community Expert
    Community Expert
    August 23, 2009

    Perhaps something like this?

    <cfset date = dateFormat(now(), "mm_dd_yyyy")>
    <cfset time = timeFormat(now(), "hh_mm_ss")>
    <cfset datetime = date & "_" & time>
    <cfset ufile = FORM.name>
    <cfset final = ufile & "" & datetime & ".txt">


    <cffile action="RENAME" source="#ExpandPath('..\original\#filename#')#" destination= "#ExpandPath('..\original\#final#')#">