Deleting A Folder (Not Empty)

Deploying to Windows? Utilizing VB Script execution? This is the place to ask Windows-specific questions.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Googie85
Posts: 199
Joined: Tue Aug 05, 2014 10:07 am

Deleting A Folder (Not Empty)

Post by Googie85 » Wed Jan 10, 2024 7:13 am

Hii Guys!!

I am trying to delete a directory that has files in it. I am able to delete the directory when there is no contents in the directory by using "folder delete". I have also tried:

put "rmdir " & quote & "d:\games\ac\content\cars\abarth500\Data\" & quote & " /s /q" into skippy
shell(skippy)

I have perused the dictionary for hours but no luck. Any replies are greatly welcomed!

Googie.

Edit: Is there a simple way to delete all the files in the selected directory?

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9388
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Deleting A Folder (Not Empty)

Post by richmond62 » Wed Jan 10, 2024 7:59 am

I don't think that this is possible: after all that capability could be used a bit like a virus to delete vital files.

Googie85
Posts: 199
Joined: Tue Aug 05, 2014 10:07 am

Re: Deleting A Folder (Not Empty)

Post by Googie85 » Wed Jan 10, 2024 8:10 am

Thanks for your reply!!!

I could get a list of the files in the folder and do something like:

repeat until i = 170
put line i of folderVar into tester
delete file tester
add 1 to i
end repeat

I was just hoping for an easier way due to there being many folders to delete. I need to delete them without a large "delay" in processing the above code or something similar.

Many Thanks,

Googie.

grzkmo
Posts: 8
Joined: Thu Aug 07, 2008 9:50 am

Re: Deleting A Folder (Not Empty)

Post by grzkmo » Thu Jan 11, 2024 12:06 am

If a folder contains any files or folders, it cannot be deleted with the delete folder command until the items inside it are deleted or moved.


----> To delete a folder that is not empty, use the revDeleteFolder command.

Post Reply

Return to “Windows”