This will superficially hide your files. (Takes directory path as argument)
#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
struct dirent *dirpent;
DIR *dirp;
char temp[1024] = {'\0'};
if(argc!=2)
{
printf("Run program again and specify path as argument\n");
return 0;
}
/// Open specified directory
dirp = opendir(argv[1]);
/// Change current working directory to specified directory
chdir(argv[1]);
if(dirp)
{
/// Keep retrieving the next directory entry
while( (dirpent=readdir(dirp)) !=NULL)
{
/// Checks for regular files and makes sure they aren't already hidden
if(dirpent->d_type == DT_REG && dirpent->d_name[0] != '.')
{
sprintf(temp, ".%s", dirpent->d_name);
rename(&temp[1], temp);
temp[0] = '\0';
}
}
/// Close directory
closedir(dirp);
}
return 0;
}