Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Cffile rename ...

New Here ,
Aug 21, 2009 Aug 21, 2009

<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

1.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 23, 2009 Aug 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#')#">

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 09, 2009 Sep 09, 2009
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources