hey I would like to delete all occurances of .o from a directory, the code below is able to delete any files that if the name ends with o for example if i hardcode hello.o it will be able to be deleted, but I would like to remove all .o suffixs without hardcoding their names. for example as long as the name ends with .o it will be deleted, anyone know any way i can do this? Is there a way to use the * to include all as you do in database queries?
Code:
void deleteObjects(struct direct *entry)
{
char *ptr;
ptr = rindex(entry->d_name, '.');
if(strcmp(ptr, ".o") == 0)
{
remove(".o");
}
}