delete all files in a dir 
Author Message
 delete all files in a dir

Dear tcl user

I am trying to delete all files in a given directory, my pseudocode
would be;
get a list of all the files
foreach item in the list do delete.

set mylist [glob "~/data/files/here/"]
foreach name $mylist {
        file delete $name


is this right?
how would one invoke the online docs or search for online help about
deleting files?


Mon, 29 Sep 2008 18:52:17 GMT  
 delete all files in a dir
You have the correct commands but the argument to glob is a glob
pattern. So use:

glob "~/data/files/here/*"

As for the man pages, I always use the ActiveState help file on



Mon, 29 Sep 2008 19:19:44 GMT  
 delete all files in a dir


Mon, 29 Sep 2008 23:18:08 GMT  
 [ 3 post ] 

 Relevant Pages 

1. Delete all files in Dir or delete Dir

2. delete complete content of a dir

3. Dir.pushdir and Dir.popdir

4. dir or not to dir

5. Delete file on file server

6. need help with rename-file/delete-file

7. no of file in sub dir

8. outputing a dir listing for use as a file sorter

9. How to Get Windows Dir info with file dates

10. Dir[] and File.stat(str).directory? on Win98

11. FileSpec vs Dir/File class methods

12. (Newbie)Outputting file sizes in a dir. listing


Powered by phpBB® Forum Software