Finding out what code is creating some hidden files

I'm getting reports that my application is creating hidden files with names starting with .f and having 9 or 10 numbers after that. For example:

.f678501541
.f1858565508

AFAIK I don't create any files with names like that!

So how to determine a) if I am creating those files and b) exactly where in my code this is happening?

Unless of course someone knows what creates files like this...

Thanks, David

  • Where are the files stored on user's device ?
  • Do you create any file in your app ?
  • If so, please show all codes where you create file ?

These .fnnnnn files appear to be created in the same directory as the input and any temp files that I create.

I create temporary files with names like DSSxxxxx.tmp and a few others. I also create output tiff or fits files.

Show MOST code where I create files:

	FrameList& FrameList::saveListToFile(fs::path file)
	{
		if (std::FILE* hFile =
#if defined(Q_OS_WIN)
			_wfopen(file.c_str(), L"wt")
#else
			std::fopen(file.c_str(), "wt")
#endif
			)
		{
// Save the bitmap to the temporary file
bool CMultiBitmap::AddBitmap(CMemoryBitmap* pBitmap, DSS::OldProgressBase* pProgress)
{
	static std::mutex initMutex{};

	ZFUNCTRACE_RUNTIME();

	if (m_bInitDone.load() == false)
	{
		auto lock = std::scoped_lock{ initMutex };
		if (m_bInitDone.load() == false)
		{
			m_lWidth = pBitmap->RealWidth();
			m_lHeight = pBitmap->RealHeight();
			InitParts(); // Will set m_bInitDone to true
			m_lNrAddedBitmaps = 0;
		}
	}

	// Save the bitmap to the file
	const size_t lScanLineSize = static_cast<size_t>(pBitmap->BitPerSample()) * (pBitmap->IsMonochrome() ? 1 : 3) * m_lWidth / 8;
	std::vector<std::uint8_t> scanLineBuffer(lScanLineSize);

	if (pProgress)
		pProgress->Start2(m_lHeight);

	for (const auto& partFile : m_vFiles)
	{
		auto dtor = [](FILE* fp) { if (fp != nullptr) fclose(fp); };
		std::unique_ptr<FILE, decltype(dtor)> pFile{
#if defined(Q_OS_WIN)
			_wfopen(partFile.file.c_str(), L"a+b"),
#else
			std::fopen(partFile.file.c_str(), "a+b"),
#endif
			dtor };

		if (pFile.get() == nullptr)
			return false;

		fseek(pFile.get(), 0, SEEK_END);

		for (int j = partFile.m_lStartRow; j <= partFile.m_lEndRow; j++)
		{
			pBitmap->GetScanLine(j, scanLineBuffer.data());
			if (fwrite(scanLineBuffer.data(), lScanLineSize, 1, pFile.get()) != 1)
				return false;

			if (pProgress)
				pProgress->Progress2(j + 1);
		}
	}

	if (pProgress)
		pProgress->End2();

	m_lNrAddedBitmaps++;

	return true;
}
bool CTIFFWriter::Open()
{
	ZFUNCTRACE_RUNTIME();
	bool bResult = false;
	constexpr unsigned char exifVersion[4] {'0', '2', '3', '1' }; // EXIF 2.31 version is 4 characters of a string!
	toff_t dir_offset_EXIF{ 0 };

#ifdef Q_OS_WIN
	m_tiff = TIFFOpenW(file.wstring().c_str(), "w");
#else
	m_tiff = TIFFOpen(reinterpret_cast<const char*>(file.u8string().c_str()), "w");
#endif
bool CFITSWriter::Open()
{
	ZFUNCTRACE_RUNTIME();
	bool			bResult = false;
	Workspace	workspace;
	char error_text[31] = "";			// Error text for FITS errors.

	bool compressFITSFile{ workspace.value("Stacking/CompressFITS", false).toBool() };

	// Create a new fits file
	int				status = 0;

	fs::remove(file);

	fits_create_diskfile(&m_fits, reinterpret_cast<const char*>(file.generic_u8string().c_str()), &status);

There's a few others that create temporary .txt files but I don't think they are relevant.

I should add that I ran fs_usage against the process for my application and exercised most of its function. No sign of .fnnnnnn files being created.

That doesn't look like standard code for Apple platforms. Are you including any 3rd party frameworks or other code? That's most likely the source of these kinds of files. They could even come from 4th party code including in your 3rd party libraries. I'm sure it's device analytics/tracking code. You probably won't see it when run from Xcode or probably even from a developer machine. Such code is designed to detect this kind of usage and only execute on end user scenarios.

Finding out what code is creating some hidden files
 
 
Q