WinDirOps
0.2.0
The module is designed to handle tasks like deleting directory contents, syncing empty directories for fast deletion, and removing directories with detailed error handling. It enables seamless interaction with the file system, whether performing maintenance tasks on local folders or managing directories across multiple remote systems.
This module can be used independently or as a dependency for higher-level file management or system configuration modules, offering flexibility and reliability in directory management operations.
---
### **Key Features:**
- **Clear directory contents (local and remote).**
- **Remove directories safely** with built-in confirmation and error handling.
- **Sync directories** for fast deletion using efficient methods like `robocopy`.
- **Handle both local and UNC paths** seamlessly, converting paths automatically for remote access.
- **Detailed status reporting** on directory operations, providing success or failure messages.
---
### **Typical Use Cases:**
- **Automating system cleanup:** Regularly clear out temporary or outdated directories, both on local machines and remote servers.
- **Managing directories during deployments:** Clear and reset build directories as part of an automated deployment or CI/CD process.
- **Remote directory management:** Delete, clear, or manage folders on remote systems without needing manual access.
- **File system maintenance:** Use **WinDirOps** to ensure file system cleanliness and order during regular system maintenance tasks.
Minimum PowerShell version
5.1
Installation Options
Owners
Copyright
(c) 2024 LarryWisherMan. All rights reserved.
Package Details
Author(s)
- LarryWisherMan
Tags
WindowsDirectories DirectoryManagement FileSystemOperations LocalDirectories RemoteDirectories PowerShellRemoting DirectoryCleanup Automation UNCPaths FileMaintenance SystemAdministration ErrorHandling DeploymentTasks RemoteManagement WindowsManagement
Functions
Clear-Directory Clear-DirectoryContents Invoke-MirRoboCopy Remove-DirectoryByType Remove-LocalDirectory Remove-RemoteDirectory
Dependencies
-
- WisherTools.Helpers (>= 0.2.0)
Release Notes
## [0.2.0] - 2024-09-10
### Added
- Added core functions
- Updated build file for release
- Added new function `Invoke-MirRoboCopy` to wrap robocopy functionality
- Added `ShouldProcess` support to all public directory-related functions to enable
safer operations using `-WhatIf` and `-Confirm`:
- Functions updated:
- `Clear-Directory`
- `Clear-DirectoryContents`
- `Remove-LocalDirectory`
- `Remove-RemoteDirectory`
- `Remove-DirectoryByType`
- `Invoke-MirRoboCopy`
- Added remote computer availability check using `Test-ComputerPing`
(see [WisherTools.Helpers](https://github.com/LarryWisherMan/WisherTools.Helpers))
for functions dealing with remote directories (`Remove-RemoteDirectory` and
`Remove-DirectoryByType`). These functions now return a `FolderDeletionResult`
indicating if the computer is offline and abort the operation if it is unreachable.
- Added enhanced error handling to return detailed failure messages, including
when a remote computer is offline or the deletion operation fails.
- Created `Invoke-RobocopyCommand` as a private wrapper for robocopy
- Created `New-FolderDeletionResult` for `FolderDeletionResult` object creation
### Changed
- Updated functions to implement `Invoke-MirRoboCopy` for faster and safer
directory content clearing using robocopy.
- Suppressed nested confirmation prompts in internal function calls by passing
`-Confirm:$false` to internal operations, preventing multiple confirmation
requests during execution.
- Improved comment-based help for all functions to clearly explain local vs.
remote operations, the role of `ShouldProcess`, and how the
remote computer checks are handled.
- updated `Remove-LocalDirectory` and `Remove-RemoteDirectory` to use new wrapper
function `New-FolderDeletionResult` for `FolderDeletionResult` object creation
FileList
- WinDirOps.nuspec
- WinDirOps.psm1
- WinDirOps.psd1
- en-US\about_WinDirOps.help.txt
Version History
Version | Downloads | Last updated |
---|---|---|
0.2.0 (current version) | 21 | 9/10/2024 |
0.2.0-previe... | 2 | 9/10/2024 |
0.2.0-previe... | 2 | 9/9/2024 |
0.2.0-previe... | 2 | 9/9/2024 |