参考URI貼るだけじゃあれなんで適当に書いたサンプルコードも貼っとく
こんな感じの処理を組み込めばディレクトリの場合だけ(その逆も)なんかの処理をするというのは可能なはず

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>

int main(void)
{
char *path = "./hoge"; /* file name */
struct stat st;

stat(path, &st); /* get information */

if (S_ISDIR(st.st_mode))
{
puts("\"path\" is directory");
} else
{
puts("\"path\" is file or something else");
}

return 0;
}