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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFFTP deleting a directory??

Status
Not open for further replies.

cfm

Programmer
Mar 27, 2001
76
CL
how can I delete a directory using CFFTP, no matter if that directory contains files or not?

thanks
 
Hey,

I can offer a little help,
This will empty a directory. Recurse it along with your RemoveDir and you'll be set.

<CFSET Dir=&quot;D:\MY\Full\Directory\Path&quot;>
<CFFTP Action=&quot;open&quot;
Server=&quot;ftp.MY-Site.com&quot;
Username=&quot;MYusername&quot;
Password=&quot;MyPassword&quot;
Connection=&quot;FtpCon&quot;>
<CFFTP Connection=&quot;FtpCon&quot; Action=&quot;ListDir&quot; Directory=&quot;#DIR#&quot; Name=&quot;Listing&quot;>
<CFloop index=&quot;x&quot; From=&quot;1&quot; to=&quot;#Listing.RecordCount#&quot;>
<CFIF #Listing.IsDirectory[x]# is &quot;No&quot;>
<CFFTP Connection=&quot;FtpCon&quot; Action=&quot;Remove&quot; Item=&quot;#Listing.Path[x]#&quot;>
</CFIF>
</CFLOOP>

Hope it Helps.
 
thank you very much!!!.

exists another form to do it? it is necessary that it eliminates directory and all its content.
 
Hi,

I'm not sure how you're removing the directory. I don't believe there is a way to do it with one simple command (Like old DOS' DelTree). If you show me how you're trying to do it I can take a minute and make it work for you with the recursive method.

 
but I am working in a FTP of linux.
coldfusion supports recursividad?
 
I believe that no.
because it is not possible to be constructed functions, except tags. thanks
 
that rare.
if it exists &quot; to createdir &quot; it would have to exist &quot; to deletedir &quot;.
 
I agree,

As far as I know the only way to remove a directory over FTP is with the <CFFTP action=&quot;remove&quot; ...
I have heard nothing but problems with it though. Many people can't get it to work because of permissions on the server.

Local Filesystem Directories (files on the computer with ColdFusion running) can be Removed with the <CFDirectory ... > tag. but only when empty.

Somebody correct me if I'm wrong.

 
You're absolutely right TL.

The permissions issues for CF on linux really require an admin who knows that installation of linux pretty well. There are different multiple permission groups for every file, and how each is setup and which user cold fusion administrator is logged into can affect who can do what from where.

Good luck if you aren't a penguin.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top