Skip to content

Instantly share code, notes, and snippets.

@mirekfranc
Created April 24, 2015 20:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mirekfranc/39e68b8657fad7d41894 to your computer and use it in GitHub Desktop.
Save mirekfranc/39e68b8657fad7d41894 to your computer and use it in GitHub Desktop.
Report file sizes :)
#include <sys/stat.h>
#include <stdio.h>
int
main (int argc, char *argv[])
{
struct stat t;
while (*++argv != NULL)
{
if (lstat (*argv, &t) == -1)
perror ("stat");
if (! S_ISREG (t.st_mode) && ! S_ISLNK (t.st_mode))
continue;
printf ("%s has %ld bytes\n", *argv, (long) t.st_size);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment