Skip to content

Commit

Permalink
closes #1; added /sl switch
Browse files Browse the repository at this point in the history
  • Loading branch information
crowbait committed Aug 21, 2023
1 parent 53d2c52 commit 35f5527
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 3 deletions.
Binary file modified Assets/settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions Classes/Operation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class Operation {
public bool IsUseFATTime { get; set; } = false; //useful when copying between two file systems, 2s precision
public bool IsRestartableBackup { get; set; } = false; //copies files in restartable mode. If file access is denied, switches to backup mode.
public bool IsCreate { get; set; } = false; //copies only folder structure, with zero-length files
public bool IsFollowSymLinks { get; set; } = true; //sl disables following sym links and instead copies the link itself
public bool IsLoggingFiles { get; set; } = true; //nfl doesn't list files names
public bool IsLoggingFolders { get; set; } = true; //ndl doesn't list folder names
public bool IsLoggingJobHeader { get; set; } = false; //njh doesn't log job header
Expand Down Expand Up @@ -127,6 +128,7 @@ public Operation(string command) {
if (parts[i].ToLower() == "/fft") { IsUseFATTime = true; }
if (parts[i].ToLower() == "/zb") { IsRestartableBackup = true; }
if (parts[i].ToLower() == "/create") { IsCreate = true; }
if (parts[i].ToLower() == "/sl") { IsFollowSymLinks = false; }
if (parts[i].ToLower() == "/nfl") { IsLoggingFiles = false; }
if (parts[i].ToLower() == "/ndl") { IsLoggingFolders = false; }
if (parts[i].ToLower() == "/njh") { IsLoggingJobHeader = false; }
Expand Down Expand Up @@ -205,6 +207,7 @@ public string GetCommand() {
if (IsUseFATTime) { command += " /fft"; }
if (IsRestartableBackup) { command += " /zb"; }
if (IsCreate) { command += " /create"; }
if (!IsFollowSymLinks) { command += " /sl"; }
if (!IsLoggingFiles) { command += " /nfl"; }
if (!IsLoggingFolders) { command += " /ndl"; }
if (!IsLoggingJobHeader) { command += " /njh"; }
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,4 @@ These items seem either impossible or at least unfeasible. Further research migh

- development using Visual Studio 2022 is recommended
- installation of [AvaloniaUI extension](https://avaloniaui.net/GettingStarted#installation) is recommended
- Solution is set up to produce self-contained `.exe` in folder `publish`, using Visual Studio's publishing function
3 changes: 3 additions & 0 deletions UI/DialogRobocopySettings.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<Grid.RowDefinitions>
<RowDefinition Height="42" />
<RowDefinition Height="42" />
<RowDefinition Height="42" />
</Grid.RowDefinitions>
<CheckBox x:Name="CheckOnlyNewer" Content="Only newer files" Grid.Column="0" Grid.Row="0" Checked="CheckOnlyNewer_Check"
ToolTip.Tip="Copy or move files to the destination folder only if the source file is newer than the target file." />
Expand All @@ -53,6 +54,8 @@
ToolTip.Tip="Tries to copy files in restartable mode. If files can't be accessed, falls back to backup mode (USE WITH CAUTION)." />
<CheckBox x:Name="CheckCreate" Content="Only structure" Grid.Column="1" Grid.Row="1"
ToolTip.Tip="Creates the folder structure AND all files, but with zero length and size." />
<CheckBox x:Name="CheckSymLinks" Content="Follow SymLinks" Grid.Column="0" Grid.Row="2"
ToolTip.Tip="When on, follows symbolic links and copies the file. If off, copies the symbolic link itself." />
</Grid>
<Grid Grid.Row="1" Margin="10,10,0,10">
<Grid.ColumnDefinitions>
Expand Down
5 changes: 5 additions & 0 deletions UI/DialogRobocopySettings.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public partial class DialogRobocopySettings : Window {
public bool FATTime { get; set; } = false;
public bool RestartableBackup { get; set; } = false;
public bool Create { get; set; } = false;
public bool FollowSymLinks { get; set; } = true;
public bool LoggingEnabled { get; set; } = true;
public bool LogFiles { get; set; } = true;
public bool LogFolders { get; set; } = true;
Expand All @@ -37,6 +38,8 @@ public DialogRobocopySettings(Operation operation) {
CheckRestartableBackup.IsChecked = RestartableBackup;
Create = operation.IsCreate;
CheckCreate.IsChecked = Create;
FollowSymLinks = operation.IsFollowSymLinks;
CheckSymLinks.IsChecked = FollowSymLinks;

LoggingEnabled = operation.IsLoggingEnabled;
CheckEnableLogging.IsChecked = LoggingEnabled;
Expand Down Expand Up @@ -83,6 +86,8 @@ private void ButtonDone_Click(object? sender, RoutedEventArgs e) {
FATTime = CheckFAT.IsChecked ?? false;
RestartableBackup = CheckRestartableBackup.IsChecked ?? false;
Create = CheckCreate.IsChecked ?? false;
FollowSymLinks = CheckSymLinks.IsChecked ?? false;

LoggingEnabled = CheckEnableLogging.IsChecked ?? false;
LogFiles = CheckLogFiles.IsChecked ?? false;
LogFolders = CheckLogFolders.IsChecked ?? false;
Expand Down
1 change: 1 addition & 0 deletions UI/RowOperationRobocopy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ public RowOperationRobocopy(int operationIndex) {
MainWindow.OperationsList[index].IsUseFATTime = dialog.FATTime;
MainWindow.OperationsList[index].IsRestartableBackup = dialog.RestartableBackup;
MainWindow.OperationsList[index].IsCreate = dialog.Create;
MainWindow.OperationsList[index].IsFollowSymLinks = dialog.FollowSymLinks;
MainWindow.OperationsList[index].IsLoggingEnabled = dialog.LoggingEnabled;
MainWindow.OperationsList[index].IsLoggingFiles = dialog.LogFiles;
MainWindow.OperationsList[index].IsLoggingFolders = dialog.LogFolders;
Expand Down
6 changes: 3 additions & 3 deletions robocopy-gui.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyVersion>2.2.1</AssemblyVersion>
<FileVersion>2.2.1</FileVersion>
<AssemblyVersion>2.3.0</AssemblyVersion>
<FileVersion>2.3.0</FileVersion>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows10.0.18362.0</TargetFramework>
<Nullable>enable</Nullable>
Expand All @@ -18,7 +18,7 @@
<ItemGroup>
<TrimmerRootAssembly Include="Avalonia.Themes.Fluent" />
</ItemGroup>

<ItemGroup>
<Content Include="Assets\icon.ico" />
</ItemGroup>
Expand Down

0 comments on commit 35f5527

Please sign in to comment.