?
Solved

CFfile rename error

Posted on 2006-05-17
5
Medium Priority
?
542 Views
Last Modified: 2013-12-24
I use the following to FTP a file then rename it.

<cfset longDate2 = #DateFormat(Now(), "yyyy/mm/dd")#>
<cfset nowTime = #TimeFormat(Now(), "hh:mm:ss")#>
<cfset RenDest = "d:\usersites\taxtalent2\htdocs\toas400new\TTNewSignup" & #longDate2# & ".txt" >
<cfset TTNewSignup = "d:\usersites\taxtalent2\htdocs\toAs400New\TTNewSignup.txt">

<p>Open a connection
<cfftp connection = "TaxSearch"
   username = "vaughn"
   password = "mustang"
   server = "192.168.1.50"
   action = "open"
   stopOnError = "Yes">

<cfftp connection = "TaxSearch"
    action = "putfile"
    stopOnError = "Yes"
    name = "#TTNewSignup#"
    directory = "/"
    localfile="#TTNewSignup#"
    remotefile="TTNewExec">
      
<cffile
   action = "rename"
   source = "#TTNewSignup#"
   destination = "#RenDest#" >



The rename fuction gets the following error:

Attribute validation error for tag CFFILE. The value of the attribute source, which is currently "d:\usersites\taxtalent2\htdocs\toAs400New\TTNewSignup.txt", is invalid.
The error occurred on line 24

I tried to shorten the file name but it makes no differrence.
0
Comment
Question by:larksys
  • 3
  • 2
5 Comments
 
LVL 18

Expert Comment

by:Plucka
ID: 16705759
larksys,

So perhaps the file hasn't finished downloading fully.

Why aren't you just putting the localfile as the RENDEST so that you dont need to rename.

<cfftp connection = "TaxSearch"
    action = "putfile"
    stopOnError = "Yes"
    name = "#TTNewSignup#"
    directory = "/"
    localfile="#RenDest#"
    remotefile="TTNewExec">

Or to check it actually finished downloading do something like

<cfif fileExists(TTNewSignup)>
    <cffile
       action = "rename"
       source = "#TTNewSignup#"
       destination = "#RenDest#" >
<cfelse>
    Didn't download or hasn't finished.
</cfif>
Regards
Plucka
0
 
LVL 1

Author Comment

by:larksys
ID: 16705852
I didn't consider the gap between FTP and rename. Thanks.

The file has to be the same name on the remote server. I just don't want to download the same data again and again.

However, I get the following error after splitting out the rename function to a second page;

Attribute validation error for tag CFFILE. The value of the attribute source, which is currently "d:\usersites\taxtalent2\htdocs\toAs400New\TTNewSignup.txt", is invalid.
The error occurred on line 9
0
 
LVL 18

Accepted Solution

by:
Plucka earned 250 total points
ID: 16706098
So,

Does the file actually exist, did you try the <cfif fileExists bit I posted.

Regards
Plucka
0
 
LVL 1

Author Comment

by:larksys
ID: 16708353
I haven't added the code to check if the file exists yet. It does exist. I just FTP'd it and that part works.
0
 
LVL 1

Author Comment

by:larksys
ID: 16739802
More research tells me that RENAME doesn't work. I am trying to COPY and DELETE instead.
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question