Re: how to check if a remote file exists
As Russ mentions, *if* you have access to the file from the CF server (which you would need in order for the 'FileExists' function to work), then you could use a tag. If you can get to it via FTP use a tag. You may need to alter your method for determining if the file exists though. If you need to use HTTP or FTP, then you can always try to get the file and if you get an error, handle it appropriately (ex. the file isn't there, etc). Regards, Michael L Gueterman Integrated Information Systems, Inc. -- -Original Message- From: Russ Michaels To: cf-talk Date: Tue, 1 Apr 2014 10:37:37 +0100 Subject: Re: how to check if a remote file exists > > if you have direct access tot he server with the file then you would > use > CFFILE to copy it. > If the file is only accessible over the web, then you can use CFHTTP to > grab the file content and save to your local server. You will of course > not > get the raw file, only what is displayed in a browser. > > > > On Tue, Apr 1, 2014 at 9:50 AM, safo 2000 > wrote: > > > > > i am a bit confused, this is the first time I do this kind of request > so > > bear with me. > > > > I am trying to do the following: > > > > i created a cf app on the source server (w2k3) > > > > > > SELECT proxloc from MainServer > > > > > > fname="#param.proxloc#\@conv_#dateformat(dateadd("d",-1,now()),'dd-mm-y > yyy')#.txt"> > > > > > > > > (the above will check for the file and find it) > > > > then i need to copy the file to the cf server and work with > it, > > that's were you lost me. > > > > not found > > > > > > > > > >ok, so then how would I do the copy from w2k3 to cf9 server > > > > > > You would use CFHTTP to grab the content from the other server, and > > > then save it as a file on your CF9 server. > > > > > > Personally I would do a separate CF app, scheduled in the CF > > > administrator, that would periodically look for the file on the > other > > > server, and if it is there, grab it and download it. > > > > > > Then when your aggregation app runs, it just has to worry about > > > content on your server. > > > > > > YMMV of course - I'm looking at it from the perspective of an > > > application I worked on where the other server wasn't that > reliable, > > > and separating the "grab files from the other server" and "process > > > files" helped troubleshooting tremendously. > > > > > > ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:358268 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: how to check if a remote file exists
What is running on your w2k3 server? Is there a web server through which the source/txt file is accessible? If so, sure, cfhttp can go out and grab it over HTTP. Being a txt file, you wouldn't have to do anything fancy, just point CFHTTP to the txt URL and then read the resulting file content or even use the path and file attributes of CFHTTP to read and save the file at the same time. If there is no web server on the W2k3 server that holds the file, then your options change. If the two servers are on the same network, then you could run the CF service as an account that has access to reach the file over UNC then just use the UNC paths like you would normal paths in your cffile tag(s). If they are not on the same network (and you can¹t set them up that way), then there are many ways that you could have the w2k3 server ³send² the file to the other machine when it generates it. I believe you said there is a visual fox pro app on the w2k3 box. If you control that app and can change it, it is capable of POSTing a file to a URL (url being a page you setup on your CF server to accept a multipart/form-data post to upload the file). If you can¹t edit the VFP app, then you could install CURL on the W2k3 box and still do the same thing Have CURL post the file to a page you set up on your CF server. Your CURL command would be a one liner that you could either schedule with windows scheduler or you could set up a service on the w2k3 box to monitor changes to the txt file and trigger the POST automatically anytime it changes. On 4/1/14, 5:37 AM, "Russ Michaels" wrote: > >if you have direct access tot he server with the file then you would use >CFFILE to copy it. >If the file is only accessible over the web, then you can use CFHTTP to >grab the file content and save to your local server. You will of course >not >get the raw file, only what is displayed in a browser. > > > >On Tue, Apr 1, 2014 at 9:50 AM, safo 2000 wrote: > >> >> i am a bit confused, this is the first time I do this kind of request so >> bear with me. >> >> I am trying to do the following: >> >> i created a cf app on the source server (w2k3) >> >> >> SELECT proxloc from MainServer >> >> > >>fname="#param.proxloc#\@conv_#dateformat(dateadd("d",-1,now()),'dd-mm-yyy >>y')#.txt"> >> >> >> >> (the above will check for the file and find it) >> >> then i need to copy the file to the cf server and work with it, >> that's were you lost me. >> >> not found >> >> >> >> > >ok, so then how would I do the copy from w2k3 to cf9 server >> > >> > You would use CFHTTP to grab the content from the other server, and >> > then save it as a file on your CF9 server. >> > >> > Personally I would do a separate CF app, scheduled in the CF >> > administrator, that would periodically look for the file on the other >> > server, and if it is there, grab it and download it. >> > >> > Then when your aggregation app runs, it just has to worry about >> > content on your server. >> > >> > YMMV of course - I'm looking at it from the perspective of an >> > application I worked on where the other server wasn't that reliable, >> > and separating the "grab files from the other server" and "process >> > files" helped troubleshooting tremendously. >> >> > > ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:358255 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: how to check if a remote file exists
if you have direct access tot he server with the file then you would use CFFILE to copy it. If the file is only accessible over the web, then you can use CFHTTP to grab the file content and save to your local server. You will of course not get the raw file, only what is displayed in a browser. On Tue, Apr 1, 2014 at 9:50 AM, safo 2000 wrote: > > i am a bit confused, this is the first time I do this kind of request so > bear with me. > > I am trying to do the following: > > i created a cf app on the source server (w2k3) > > > SELECT proxloc from MainServer > > fname="#param.proxloc#\@conv_#dateformat(dateadd("d",-1,now()),'dd-mm-')#.txt"> > > > > (the above will check for the file and find it) > > then i need to copy the file to the cf server and work with it, > that's were you lost me. > > not found > > > > > >ok, so then how would I do the copy from w2k3 to cf9 server > > > > You would use CFHTTP to grab the content from the other server, and > > then save it as a file on your CF9 server. > > > > Personally I would do a separate CF app, scheduled in the CF > > administrator, that would periodically look for the file on the other > > server, and if it is there, grab it and download it. > > > > Then when your aggregation app runs, it just has to worry about > > content on your server. > > > > YMMV of course - I'm looking at it from the perspective of an > > application I worked on where the other server wasn't that reliable, > > and separating the "grab files from the other server" and "process > > files" helped troubleshooting tremendously. > > ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:358253 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: how to check if a remote file exists
i am a bit confused, this is the first time I do this kind of request so bear with me. I am trying to do the following: i created a cf app on the source server (w2k3) SELECT proxloc from MainServer (the above will check for the file and find it) then i need to copy the file to the cf server and work with it, that's were you lost me. not found > >ok, so then how would I do the copy from w2k3 to cf9 server > > You would use CFHTTP to grab the content from the other server, and > then save it as a file on your CF9 server. > > Personally I would do a separate CF app, scheduled in the CF > administrator, that would periodically look for the file on the other > server, and if it is there, grab it and download it. > > Then when your aggregation app runs, it just has to worry about > content on your server. > > YMMV of course - I'm looking at it from the perspective of an > application I worked on where the other server wasn't that reliable, > and separating the "grab files from the other server" and "process > files" helped troubleshooting tremendously. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:358252 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: how to check if a remote file exists
>ok, so then how would I do the copy from w2k3 to cf9 server You would use CFHTTP to grab the content from the other server, and then save it as a file on your CF9 server. Personally I would do a separate CF app, scheduled in the CF administrator, that would periodically look for the file on the other server, and if it is there, grab it and download it. Then when your aggregation app runs, it just has to worry about content on your server. YMMV of course - I'm looking at it from the perspective of an application I worked on where the other server wasn't that reliable, and separating the "grab files from the other server" and "process files" helped troubleshooting tremendously. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:358245 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: how to check if a remote file exists
Using cffile? Russ Michaels www.michaels.me.uk cfmldeveloper.com cflive.net cfsearch.com On 31 Mar 2014 08:32, "safo 2000" wrote: > > thanks for the info > > ok, so then how would I do the copy from w2k3 to cf9 server > > ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:358244 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: how to check if a remote file exists
thanks for the info ok, so then how would I do the copy from w2k3 to cf9 server ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:358243 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: how to check if a remote file exists
> Oh good point there. So - ignoring my server where I don't have a proper > 404 (grin), this should work for you: > > http://www.cnn.com/index2332.cfm";> > > good > Your original point is perfectly valid, though - lots of people don't return proper status codes. So it is useful to have some additional logic to deal with soft 404s if you're testing against unfamiliar servers. Dave Watts, CTO, Fig Leaf Software 1-202-527-9569 http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our training centers, online, or onsite. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:358232 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: how to check if a remote file exists
Oh good point there. So - ignoring my server where I don't have a proper 404 (grin), this should work for you: http://www.cnn.com/index2332.cfm";> good On Sat, Mar 29, 2014 at 9:38 AM, Dave Watts wrote: > > > You can use fileExists w/ a URL but unfortunately, if the server has a > 404 > > handler than it will return true even when the 404 handler fires. > > > > http://www.raymondcamden.com/index2332.cfm";)> > > yes > > > > > > http://www.raymondcamden.com/index2332.cfm";> > > > > > > If a 404 handler isn't there, then this would have worked. > > If you're building a 404 handler, you should actually make sure it > returns a 404 status code. You can do this easily enough with > CFHEADER. The page can contain whatever HTML you want to present to > the user, still. > > I run into this quite a bit working with the Google Search Appliance. > The GSA relies on status codes by default to identify which pages to > index. While it's possible to give it a way to identify soft 404s > (http://en.wikipedia.org/wiki/HTTP_404#Soft_404), it's much easier > just to have real 404s in the first place. > > Dave Watts, CTO, Fig Leaf Software > 1-202-527-9569 > http://www.figleaf.com/ > http://training.figleaf.com/ > > Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on > GSA Schedule, and provides the highest caliber vendor-authorized > instruction at our training centers, online, or onsite. > > ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:358231 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: how to check if a remote file exists
> You can use fileExists w/ a URL but unfortunately, if the server has a 404 > handler than it will return true even when the 404 handler fires. > > http://www.raymondcamden.com/index2332.cfm";)> > yes > > > http://www.raymondcamden.com/index2332.cfm";> > > > If a 404 handler isn't there, then this would have worked. If you're building a 404 handler, you should actually make sure it returns a 404 status code. You can do this easily enough with CFHEADER. The page can contain whatever HTML you want to present to the user, still. I run into this quite a bit working with the Google Search Appliance. The GSA relies on status codes by default to identify which pages to index. While it's possible to give it a way to identify soft 404s (http://en.wikipedia.org/wiki/HTTP_404#Soft_404), it's much easier just to have real 404s in the first place. Dave Watts, CTO, Fig Leaf Software 1-202-527-9569 http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our training centers, online, or onsite. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:358230 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: how to check if a remote file exists
You can use fileExists w/ a URL but unfortunately, if the server has a 404 handler than it will return true even when the 404 handler fires. http://www.raymondcamden.com/index2332.cfm";)> yes http://www.raymondcamden.com/index2332.cfm";> If a 404 handler isn't there, then this would have worked. On Sat, Mar 29, 2014 at 2:19 AM, safo 2000 wrote: > > hi, > > i have w2k3 server that holds a text file, say x.txt, generated by an VFP9 > app., on a separate server i have a cf9 app. that needs to check for file > x, if it exists get a copy of it and merge it with another text file that > is generated by the app. > well, how can i do the checking part? > > ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:358221 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
how to check if a remote file exists
hi, i have w2k3 server that holds a text file, say x.txt, generated by an VFP9 app., on a separate server i have a cf9 app. that needs to check for file x, if it exists get a copy of it and merge it with another text file that is generated by the app. well, how can i do the checking part? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:358220 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm