Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
aac9402
Now can scan for duplicate files
TheGuitarleader Aug 25, 2025
2b9d004
Refactored compressing files code
TheGuitarleader Aug 26, 2025
5c80fab
Added quick start to readme
TheGuitarleader Aug 26, 2025
8a71619
Renamed profiles to vaults
TheGuitarleader Aug 26, 2025
4f7b01a
Renamed backup to sync for pushing and pulling files
TheGuitarleader Aug 26, 2025
b3e136b
Added checksums to files for better change detection
TheGuitarleader Aug 26, 2025
86780c5
Added logging
TheGuitarleader Aug 26, 2025
ac213fc
Moved to security folder
TheGuitarleader Aug 26, 2025
8076a36
Now uses checksums to validate file changes
TheGuitarleader Aug 26, 2025
dea9adc
Changed byte arrays to strings for ease with database querying
TheGuitarleader Aug 26, 2025
73c9f89
Various async changes
TheGuitarleader Aug 29, 2025
4cd81e7
Optimized for pushing to multiple vaults
TheGuitarleader Sep 1, 2025
8b5d7b3
Moved service to separate branch
TheGuitarleader Sep 1, 2025
bdf3c04
Removed service from sln
TheGuitarleader Sep 1, 2025
45c98ea
Merge pull request #20 from TheGuitarleader/feature/profiles
TheGuitarleader Sep 1, 2025
b2db4eb
Update README.md
TheGuitarleader Sep 1, 2025
a067ebf
Massive changes to file pushing
TheGuitarleader Sep 2, 2025
637c1fb
IT BUILDS
TheGuitarleader Sep 2, 2025
f29df6a
Now that databases are instanced there is no need to store a vault id
TheGuitarleader Sep 2, 2025
8f74ee5
Works fine except for uploading the database
TheGuitarleader Sep 2, 2025
bf7832b
Successfully pushes files
TheGuitarleader Sep 2, 2025
c0a5f2b
Now can push via SSH
TheGuitarleader Oct 26, 2025
ab92e55
Various performance increases
TheGuitarleader Nov 10, 2025
3057dee
Added new configuration for analyzing builds
TheGuitarleader Nov 10, 2025
44b6ced
Now cleans old files off the system and moved the retention time vari…
TheGuitarleader Nov 11, 2025
394dc3b
Merge pull request #22 from TheGuitarleader/feature/cleaning
TheGuitarleader Nov 11, 2025
53d9965
Added build script
TheGuitarleader Nov 11, 2025
87e094b
Added disk command for looking at the vaults current capacity
TheGuitarleader Nov 11, 2025
6be8dd6
Minor improvements
TheGuitarleader Nov 11, 2025
a280312
Changed up the display
TheGuitarleader Nov 11, 2025
d939db9
Merge pull request #25 from TheGuitarleader/feature/disk
TheGuitarleader Nov 11, 2025
866b027
Various changes
TheGuitarleader Nov 12, 2025
cb780e8
Fixed some explicit type issues
TheGuitarleader Dec 5, 2025
db2e64c
New debug setting
TheGuitarleader Dec 5, 2025
99ead3d
Fixed issue #21
TheGuitarleader Dec 5, 2025
43c806b
This commit is a mess, ngl
TheGuitarleader Dec 5, 2025
fdef293
Merge pull request #26 from TheGuitarleader/feature/blobs
TheGuitarleader Dec 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*.userosscache
*.sln.docstates
*.sln
*.lnk

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
Expand Down Expand Up @@ -397,4 +398,7 @@ FodyWeavers.xsd

# JetBrains Rider
*.sln.iml
.idea/
.idea/

# Batch Script Outputs
Builds/
13 changes: 13 additions & 0 deletions Build-Release.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@echo off

set SCRIPT_DIR=%~dp0
set BUILDS_DIR="%SCRIPT_DIR%Builds"

echo Building to folder: %BUILDS_DIR%
rd /s /q "%BUILDS_DIR%"

echo Building Parallel.Cli...
CALL dotnet publish "%SCRIPT_DIR%Parallel.Cli\Parallel.Cli.csproj" -r win-x64 -c Release /p:PublishSingleFile=true /p:PublishDir="%BUILDS_DIR%\Parallel.Cli\win-x64"
CALL dotnet publish "%SCRIPT_DIR%Parallel.Cli\Parallel.Cli.csproj" -r osx-x64 -c Release /p:PublishSingleFile=true /p:PublishDir="%BUILDS_DIR%\Parallel.Cli\osx-x64"
CALL dotnet publish "%SCRIPT_DIR%Parallel.Cli\Parallel.Cli.csproj" -r linux-x64 -c Release /p:PublishSingleFile=true /p:PublishDir="%BUILDS_DIR%\Parallel.Cli\linux-x64"
CALL dotnet publish "%SCRIPT_DIR%Parallel.Cli\Parallel.Cli.csproj" -r linux-arm -c Release /p:PublishSingleFile=true /p:PublishDir="%BUILDS_DIR%\Parallel.Cli\linux-arm"
126 changes: 126 additions & 0 deletions Parallel.Cli/Commands/CleanCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
// Copyright 2025 Kyle Ebbinga

using System.CommandLine;
using Parallel.Cli.Utils;
using Parallel.Core.IO.Scanning;
using Parallel.Core.IO.Syncing;
using Parallel.Core.Settings;
using Parallel.Core.Utils;

namespace Parallel.Cli.Commands
{
public class CleanCommand : Command
{
private long _freedBytes = 0;
private int _filesCount = 0;
private int _dirsCount = 0;

private readonly Option<string> _sourceOpt = new(["--path", "-p"], "The source path to clean.");
private readonly Option<int> _daysOpt = new(["--days", "-d"], "The amount of days to hang onto files.");
private readonly Option<bool> _recursiveOpt = new(["--recursive", "-R"], "If to include subdirectories.");
private readonly Option<bool> _verboseOpt = new(["--verbose", "-v"], "Shows verbose output.");

public CleanCommand() : base("clean", "Cleans up the file system by removing old files.")
{
this.AddOption(_sourceOpt);
this.AddOption(_daysOpt);
this.AddOption(_recursiveOpt);
this.AddOption(_verboseOpt);
this.SetHandler(async (path, days, recursive, verbose) =>
{
ParallelConfig config = ParallelConfig.Load();
if (days <= config.RetentionPeriod) days = config.RetentionPeriod;

if (string.IsNullOrEmpty(path))
{
await CleanSystemAsync(config, days, recursive, verbose);
}
else
{
await CleanDirectoryAsync(config, path, days, recursive, verbose);
}

CommandLine.WriteLine($"Successfully cleaned {_filesCount:N0} files and {_dirsCount:N0} directories, ({Formatter.FromBytes(_freedBytes)} removed)", ConsoleColor.Green);
}, _sourceOpt, _daysOpt, _recursiveOpt, _verboseOpt);
}

private async Task CleanSystemAsync(ParallelConfig config, int days, bool recursive, bool verbose)
{
await System.Threading.Tasks.Parallel.ForEachAsync(config.CleanDirectories, ParallelConfig.Options, async (path, ct) =>
{
await CleanDirectoryAsync(config, path, days, recursive, verbose);
});
}

private async Task CleanDirectoryAsync(ParallelConfig config, string path, int days, bool recursive, bool verbose)
{
CommandLine.WriteLine($"Scanning for cleanable files older than {days:N0} days old in {path}...", ConsoleColor.DarkGray);
if (!Directory.Exists(path))
{
CommandLine.WriteLine($"The provided path was not found!", ConsoleColor.Yellow);
return;
}

UnixTime minTime = UnixTime.FromMilliseconds(UnixTime.Now.TotalMilliseconds - (days * UnixTime.Day));
IEnumerable<FileInfo> cleanableFiles = FileScanner.GetCleanableFiles(path, minTime, recursive);
if (!cleanableFiles.Any()) CommandLine.WriteLine($"No cleanable files were found in the provided path.", ConsoleColor.Green);

await System.Threading.Tasks.Parallel.ForEachAsync(cleanableFiles, ParallelConfig.Options, (fi, ct) =>
{
if (fi.Exists)
{
try
{
_freedBytes += fi.Length;
_filesCount++;
fi.Delete();
}
catch (Exception ex)
{
CommandLine.WriteLine($"Unable to remove file: {fi.FullName}", ConsoleColor.Yellow);
Log.Warning($"{ex.GetBaseException().Message}");
}
}

return ValueTask.CompletedTask;
});

IEnumerable<DirectoryInfo> directories = FileScanner.GetEmptyDirectories(path, recursive);
if (!directories.Any()) CommandLine.WriteLine($"No empty directories were found in the provided path.", ConsoleColor.Green);

await System.Threading.Tasks.Parallel.ForEachAsync(directories, ParallelConfig.Options, (di, ct) =>
{
if (di.Exists && !di.EnumerateFiles().Any())
{
try
{
Log.Debug($"Removing empty directory: {di?.FullName}");
di?.Delete(true);
}
catch (Exception ex)
{
Log.Error($"{ex.GetBaseException().Message}");
}
}

return ValueTask.CompletedTask;
});

DirectoryInfo currentDir = new DirectoryInfo(path);
SearchOption option = recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly;
if (!currentDir.EnumerateFiles("*", option).Any())
{
try
{
Log.Debug($"Removing empty directory: {currentDir.FullName}");
currentDir.Delete(true);
_dirsCount++;
}
catch (Exception ex)
{
Log.Warning($"{ex.GetBaseException().Message}");
}
}
}
}
}
86 changes: 0 additions & 86 deletions Parallel.Cli/Commands/ConfigCommand.cs

This file was deleted.

103 changes: 0 additions & 103 deletions Parallel.Cli/Commands/DecryptCommand.cs

This file was deleted.

Loading
Loading