Page 1 of 1

(delete-file) does not accept wildcards?

Posted: Tue Dec 11, 2007 2:42 pm
by pjot
Hi,

It seems that this code is not working:
> (delete-file "somedir/*.*")
nil
Why not? Do I first have to setup a list of files in that directory, and then walk through that list to delete them one-by-one...? :-(

Regards
Peter

Posted: Tue Dec 11, 2007 3:45 pm
by cormullion
I suspect that delete-file only takes a filename, not a pathname. So *.* isn't valid.

Just a thought.

Posted: Tue Dec 11, 2007 4:53 pm
by pjot

Code: Select all

(dolist (x (directory temp_dir)) (delete-file (append temp_dir "/" x)))
...but the wildcard is more easy.

Peter