Is there a difference between unlink () and remove () in a file?

In C ++ on Linux, I see that on the man page for remove () it partially states:

delete removes the name from the file system. It calls unlink for files and rmdir for directories.

So I'm wondering if there is a difference between calling remove () or unink () in a file? Perhaps the only difference is that unlink () is a bit faster because it doesn't need to handle directories?

+4
source share
1 answer

The remove() function removes the file or directory specified in the path.

If the path indicates a directory, remove(path) is the equivalent of rmdir(path) . Otherwise, it is the equivalent of unlink(path) .

From: man remove .

Good luck;)

+5
source

All Articles