Delete files and directories

From Cuis CookBook
Jump to navigation Jump to search

Problem I want to delete a file or directory, how do I do it ?

Solution. One way is following the next snippet. Observe well there is an asymmetry in the way the delete message behaves in case the file or directory is non existent.

"No error if file does not exist"
'/home/p/testFile.txt' asFileEntry delete. 

"There is an error if the directory does not exist "
'/home/p/testDir' asDirectoryEntry delete. 

Dr. Nicola Mingotti last edited this on 06-Sep-2021. Tested in Cuis5.0-4834.image.