<commit_before>/*
	CacheSlim.exe [/D TIMEOUT-DAY | /H TIMEOUT-HOUR] CACHE-DIR "DELETE-OLD-CACHE"

		TIMEOUT-DAY  ... ̓ȏ̂̃t@C͍폜B
		TIMEOUT-HOUR ... ̎Ԉȏ̂̃t@C͍폜B
*/

#include "C:\Factory\Common\all.h"

static time_t TimeoutSec = 86400 * 7ui64; // 1 week
static char *RootDir;

typedef struct FileInfo_st
{
	char *File;
	time_t CWTime;
}
FileInfo_t;

static autoList_t *FileInfos;

static FileInfo_t *CreateFileInfo(char *file)
{
	FileInfo_t *i = nb(FileInfo_t);
	uint64 c;
	uint64 w;
	uint64 cw;

	i->File = strx(file);
	getFileStamp(file, &c, NULL, &w);
	cw = m_max(c, w);
	i->CWTime = getTimeByFileStamp(cw);

	return i;
}
static void ReleaseFileInfo(FileInfo_t *i)
{
	memFree(i->File);
	memFree(i);
}
static void InitFileInfos(void)
{
	autoList_t *files;
	char *file;
	uint index;

	LOGPOS();

	files = cmdDir_lssFiles(RootDir);
	FileInfos = newList();

	foreach(files, file, index)
		addElement(FileInfos, (uint)CreateFileInfo(file));

	releaseDim(files, 1);

	LOGPOS();
}

// ---- slim ----

static time_t CurrTime;

static void SlimFile(FileInfo_t *i)
{
	time_t timeOld = CurrTime - i->CWTime;

	cout("%s\n", i->File);

	if(timeOld < 3600)
		cout("%I64d b", timeOld);
	else if(timeOld < 86400)
		cout("%.3f ", timeOld / 3600.0);
	else
		cout("%.3f ", timeOld / 86400.0);

	cout("OɐEXVꂽt@CłB\n");

	if(TimeoutSec <= timeOld)
	{
		cout("폜܂B\n");
//		removeFile(i->File);
	}
	else
		cout("L[v܂B\n");
}
static void SlimFiles(void)
{
	FileInfo_t *i;<commit_msg>daily<commit_after>/*
	CacheSlim.exe [/D TIMEOUT-DAY | /H TIMEOUT-HOUR] CACHE-DIR "DELETE-OLD-CACHE"

		TIMEOUT-DAY  ... ̓ȏ̂̃t@C͍폜B
		TIMEOUT-HOUR ... ̎Ԉȏ̂̃t@C͍폜B
*/

#include "C:\Factory\Common\all.h"

static time_t TimeoutSec = 86400 * 7ui64; // 1 week
static char *RootDir;

typedef struct FileInfo_st
{
	char *File;
	time_t CWTime;
}
FileInfo_t;

static autoList_t *FileInfos;

static FileInfo_t *CreateFileInfo(char *file)
{
	FileInfo_t *i = nb(FileInfo_t);
	uint64 c;
	uint64 w;
	uint64 cw;

	i->File = strx(file);
	getFileStamp(file, &c, NULL, &w);
	cw = m_max(c, w);
	i->CWTime = getTimeByFileStamp(cw);

	return i;
}
static void ReleaseFileInfo(FileInfo_t *i)
{
	memFree(i->File);
	memFree(i);
}
static void InitFileInfos(void)
{
	autoList_t *files;
	char *file;
	uint index;

	LOGPOS();

	files = cmdDir_lssFiles(RootDir);
	FileInfos = newList();

	foreach(files, file, index)
		addElement(FileInfos, (uint)CreateFileInfo(file));

	releaseDim(files, 1);

	LOGPOS();
}

// ---- slim ----

static time_t CurrTime;

static void SlimFile(FileInfo_t *i)
{
	time_t timeOld = CurrTime - i->CWTime;

	cout("%s\n", i->File);

	if(timeOld < 3600)
		cout("%I64d b", timeOld);
	else if(timeOld < 86400)
		cout("%.3f ", timeOld / 3600.0);
	else
		cout("%.3f ", timeOld / 86400.0);

	cout("OɐEXVꂽt@CłB\n");

	if(TimeoutSec <= timeOld)
	{
		cout("폜܂B\n");
		removeFile(i->File);
	}
	else
		cout("L[v܂B\n");
}
static void SlimFiles(void)
{
	FileInfo_t *i;
{'fraction_non_alphanumeric': 0.17606602475928473, 'fraction_numerical': 0.027510316368638238, 'mean_word_length': 3.9726495726495727, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6497673', 'n_tokens_mistral': 1435, 'n_tokens_neox': 1347, 'n_words': 259}