c - How to find execute files in Linux? -
c - How to find execute files in Linux? -
i wants names of execute files in directory in linux. how can it?
i tried utilize opendir this:
dir = opendir(directoryname);
i need names of execute files. programming in c.
thanks :)
you should define mean executable files.
that file execute bit (it owner, group, or other) set. test access(2) & x_ok
and/or utilize stat(2).
that elf executables. see elf(5); issue might check file indeed executed, might hard (what missing library dependencies? or ill-formed elf files?). maybe utilize libelf (and/or libmagic equivalent of file(1) command).
to scan recursively file tree, utilize nftw(3); scan directory utilize opendir(3) & readdir(3) (don't forget closedir
!), you'll need build finish file path each directory entry (perhaps using snprintf(3) or asprintf(3))
see advanced linux programming
c linux ubuntu directory system-calls
Comments
Post a Comment