Solved

CFFTP to IIS5 FTP Server Does not List contents of Folders with Long File Names

Posted on 2003-11-21
4
426 Views
Last Modified: 2013-12-24
I have a page I am working on that accesses an FTP server where folders and files have long file names with spaces in them. I need to be able to access them, but when I use the CFFTP command to list the contents of a folder with spaces in the name, it does not return anything. This does not happen with folders that have no spaces in them. I am using Coldfusion MX 6.1 with Dreamweaver MX 2004 on a Windows 2000 Server running the native webserver that comes with Coldfusion (for testing purposes, production server is IIS5).

I stress that this is only a problem with connecting to an IIS FTP server. This does not happen if I am using a FileZilla as my FTP server. I need to use IIS (or something similar) that will use the username/password provided at the FTP login as the authentication for the filesystem, too (any recommendations gladly considered).

My code looks like this (some variables changed to protect internal security, but conventions left the same):

<cfftp
action="listdir"
directory="/Oggs Files/Vacation to the Tarpits/"
name="DirectoryListing"
server="caveserver"
username="pandora\ogg"
password="oogabooga38"
port="22">

<cfoutput query="DirectoryListing">
      #DirectoryListing.Name#
      <br>
</cfoutput>

How do I get it so that it will read folder names that have spaces in it? I have been unable to find anything to help solve the problem all day.

Thanks!

Greg Moore
SRG Partnership Architects
0
Comment
Question by:gregmoore
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 17

Expert Comment

by:anandkp
ID: 9801698
Hi use this syntax ... this is what i use & works perfect for me !

<CFFTP CONNECTION="Anand" <!--- give a name to the connection --->
         USERNAME="anonymous" <!--- dont chnage this unless u have given username & passwords --->
         PASSWORD="userName@company.com" <!--- dont chnage this unless u have given username & passwords --->
         SERVER = "192.168.3.38" <!---  IP of teh server from where u wanna read the file --->
         ACTION="Open"
         STOPONERROR="Yes">

<CFIF CFFTP.SUCCEEDED>    
 
    <!--- transfer of the file - Picking up from the FTP server --->
    <CFFTP
      ACTION = "getfile"
      CONNECTION = "Anand"
      LOCALFILE = "D:\akp.htm" <!--- Path where u wanna store the file --->
      REMOTEFILE = "a\New Folder\menu.htm" <!--- a = alias of the FTP server & then the folder path to the file --->
      > 
   
    <CFFTP CONNECTION="Anand"
             ACTION="close"
             STOPONERROR="Yes">
                 
</CFIF>

let me know

K'Rgds
Anand

0
 
LVL 17

Accepted Solution

by:
anandkp earned 500 total points
ID: 9801718
& the same logic wld go for listing directories on a FTP server

<CFFTP CONNECTION="Anand" <!--- give a name to the connection --->
      USERNAME="anonymous" <!--- dont chnage this unless u have given username & passwords --->
      PASSWORD="userName@company.com" <!--- dont chnage this unless u have given username & passwords --->
      SERVER = "192.168.3.38" <!---  IP of teh server from where u wanna read the file --->
      ACTION="Open"
      STOPONERROR="Yes">

<CFIF CFFTP.SUCCEEDED>    

      <CFFTP
            ACTION = "ListDir"
            CONNECTION = "Anand"
            DIRECTORY = "a" <!--- a = alias of the FTP server & then the folder path to the file --->
            NAME = "akp">
             
      <CFOUTPUT QUERY="akp">
            #CurrentRow# - #Name#
      </CFOUTPUT>

      <CFFTP CONNECTION="Anand"
            ACTION="close"
            STOPONERROR="Yes">
               
</CFIF>

HTH

K'Rgds
Anand
0
 

Author Comment

by:gregmoore
ID: 9813275
Anand,

Thank you for the comments. It did not solve the problem, however. I was still unable to list the contents of folders with long names. I did figure out, through some testing, that I could access those folders if I used the 8.3 naming convention. That wasn't going to work either.

HOWEVER - Your advice did steer me in the right direction: Establishing an FTP connection and then running commands within that connection and then closing the connection when done.

Instead of trying to do the entire directory listing from one cfftp command, I changed the code to open a connection, change the directory, list the contents, and then close the connection.

For some reason, if I change the directory to the long folder name and then list a blank directory, it works like a charm! I guess there's something about listing a specfic directory on IIS that just doesn't work with the cfftp directory= variable and the action="listdir" function.

I used the following strategy, and it seems to have worked:

<!--- Establish FTP Connection --->
      
      <cfftp
      action="open"
      connection="#CurrentSessionID#"  
      server="#ServerName#"
      username="#UserName#"
      password="#Password#"
      port="#PortNo#">
      
<!--- Establish Current Directory --->
      
      <cfftp
      action="changedir"
      connection = "#CurrentSessionID#"
      directory="#URL.CurrentFolder#">

<!--- List Current Directory --->

      <cfftp
      action="listdir"
      connection="#CurrentSessionID#"
      stoponerror="no"
      name="FTPFolderContents"
      Passive="no"
      Directory="">

<!--- Close the Connection --->

      <cfftp action="close" connection="#CurrentSessionID#">

After that, I can run my CFOUTPUT loop and the folders and files come out right!

For your time and leading me in the right direction, I'll give you 1/2 the points!

Thanks again!

Greg
0
 
LVL 17

Expert Comment

by:anandkp
ID: 9815617
Its ok ... I am not bothered abt the points

I still wonder abt the long dir names :(
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Has my website been infiltrated? 21 73
Webserver access problem 5 78
Moving web servers into a DMZ? 3 89
move expression web site to a new server 13 110
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Suggested Courses

710 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