<commit_before>﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;

namespace AppMetrics.AgentService
{
	public static class FileUtil
	{
		public static void DeleteAllFiles(string path)
		{
			var repeatCount = 10;

			while (true)
			{
				try
				{
					foreach (var file in Directory.GetFiles(path))
					{
						File.Delete(file);
					}
					break;
				}<commit_msg>remove readonly attribute when trying to delete files<commit_after>﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;

namespace AppMetrics.AgentService
{
	public static class FileUtil
	{
		public static void SetAttributes(string fileName, FileAttributes attr)
		{
			File.SetAttributes(fileName, File.GetAttributes(fileName) | attr);
		}

		public static void ResetAttributes(string fileName, FileAttributes attr)
		{
			if (HasAttributes(fileName, attr))
				File.SetAttributes(fileName, File.GetAttributes(fileName) & ~attr);
		}

		public static bool HasAttributes(string fileName, FileAttributes attr)
		{
			return ((File.GetAttributes(fileName) & attr) == attr);
		}

		public static void DeleteAllFiles(string path)
		{
			var repeatCount = 10;

			while (true)
			{
				try
				{
					foreach (var file in Directory.GetFiles(path))
					{
						ResetAttributes(file, FileAttributes.ReadOnly);
						File.Delete(file);
					}
					break;
				}
{'fraction_non_alphanumeric': 0.0928813559322034, 'fraction_numerical': 0.002711864406779661, 'mean_word_length': 3.670886075949367, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5595687', 'n_tokens_mistral': 534, 'n_tokens_neox': 436, 'n_words': 115}