ASKER
ASKER
$pathname = Read-Host "Please Enter Path Name: "
GCI $pathname -Recurse |
?{$_.LastAccessTime -le (Get-date).AddMonths(-1)} |
Select FullName,CreationTime,LastAccessTime,LastWriteTime |
Export-Csv "c:\$(($pathname -split "\\")[-1]).csv" -NTI
ASKER
(Get-Date).AddDays(-1) -lt (Get-Date)
ASKER
ASKER
$path = 'C:\Source'
$stagingPath = 'D:\Destination'
Push-Location $path
Get-ChildItem $path -Recurse -File |
Where-Object LastAccessTime -le (Get-date).AddMonths(-1) |
ForEach-Object {
$relative = Resolve-Path $_.Directory -Relative
$destination = Join-Path $stagingPath $relative.TrimStart('.')
if (-not (Test-Path $destination)) {
$null = New-Item $destination -ItemType Directory
}
Copy-Item $_.FullName -Destination $destination
}
Pop-Location
Start with that and check the size of everything. If it works, Copy-Item can be change to Move-Item (possibly). Alternatively, we can do one pass to generate the list, archive things, and if that works, delete the items on the list.
ASKER
$pathname = "C:\Users\kabir.uddin"
$files = Get-ChildItem $pathname -Recurse -File |
Where-Object LastAccessTime -le (Get-date).AddMonths(-1)
foreach ($f in $files)
{
$Name = $f.fullname
#Compress-Archive $f -DestinationPath $path\$Name.zip
}
ASKER
ASKER
Windows PowerShell is a task automation and configuration management framework from Microsoft, consisting of a command-line shell and associated scripting language built on the .NET Framework. PowerShell provides full access to the Component Object Model (COM) and Windows Management Instrumentation (WMI), enabling administrators to perform administrative tasks on both local and remote Windows systems as well as WS-Management and Common Information Model (CIM) enabling management of remote Linux systems and network devices.
TRUSTED BY
Open in new window