Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List files in different system directory

Status
Not open for further replies.

dinoviapangea

Technical User
Apr 9, 2002
41
US
How can I list the contents of a directory that is not on the server I am using. I know I can use CFDIRECTORY to list contents of any directory on the Coldfusion server but what about another server or system?

Thanks
 
What type of server do you mean?

If it's a web server, the web server would have to permit directory listings. Then it's usually accomplished by accessing the directory path as an URL (make sure the directory doesn't contain a default document, like index.cfm or default.htm, etc).

So, for example,
would give you a directory listing of
f:\html\or whatever. But, again, the server must be set to permit it.


If you're talking a box with an FTP server on it, you can call CFFTP like:
Code:
<CFFTP action=&quot;LISTDIR&quot; name=&quot;qryDirList&quot; directory=&quot;f:\html\[URL unfurl="true"]wwwroot\mypath\mydirectory&quot;[/URL] ...>
<CFDUMP var=&quot;#qryDirList#&quot;>

Otherwise, you'd need to set up an &quot;agent&quot; page on the server B that does a CFDIRECTORY (or equivilent, if it doesn't run ColdFusion). Then the page on server A would do a CFHTTP to request that page, and grab the CFFILE.filecontents that's returned.


Those are the only ways I know to do it... other than through a file share/samba... but then you'd just use CFDIRECTORY like you normally would, and specify the mapped drive/directory as if it were a local path.








-Carl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top