The Daily Click ::. Forums ::. Klik Coding Help ::. Deleting directories with the File Object
 

Post Reply  Post Oekaki 
 

Posted By Message

Chris Burrows



Registered
  14/09/2002
Points
  2396

GOTW WINNER OCT. 2011
16th April, 2012 at 16/04/2012 10:46:55 -

Hello,

I am having difficulty deleting a directory with the File Object. When you chose to "Delete a Directory", what exactly do you enter?

For example, to delete the folder "Data" in "C:\Test" what must I type?

I have tried just using the full directory path, "C:\Test\Data" and this doesn't work.

I have also tried changing the current directory to "C:\Test" and then using "Data" as the directory to delete but it doesn't work either.

Any suggestions?

Thank you

 
n/a

Chris Burrows



Registered
  14/09/2002
Points
  2396

GOTW WINNER OCT. 2011
16th April, 2012 at 16/04/2012 10:52:18 -

Solved.

Delete a directory requires the full path of the directory. But it wasn't working for me because it can only delete empty directories.

 
n/a

s-m-r

Slow-Motion Riot

Registered
  04/06/2006
Points
  1078

Candle
16th April, 2012 at 16/04/2012 22:23:23 -

What would you use to delete the files in the directory so that the directory becomes empty? I assume the File Object?

 
n/a

Chris Burrows



Registered
  14/09/2002
Points
  2396

GOTW WINNER OCT. 2011
17th April, 2012 at 17/04/2012 08:20:57 -

Yes, you could do it that way. You would have to make a list of the files in that folder, either with the Tree Control extension or using the Load Files List function of the List Object, and then run a loop deleting the files one at a time based on their line number in the list and the Loop Index.

And that was how I was doing it, until I discovered the File-Folder object by Sphax. It can delete a folder plus everything inside in a single action. Thank you Sphax!!!!!!

 
n/a
   

Post Reply



 



Advertisement

Worth A Click