0

Hi everybody thanks for your help, this is what I've done. The Main goal is to move content of Downloads into Recycle bin if is a folder or whatever it is I can't figure out why I run it and after moving items can't seen them in the Desktop>recycle bin I found the items in c:$Recycle.bin what do you suggest? thanks again

#Requires -Version 5.1 
    param (
    [string] $path = "$env:HOMEPATH\Downloads\")
$myBool = Test-Path $path 
    if ($myBool -eq $false) 
    {
    "Path does not exist, Input the path to folder"
    } 
    else {
Get-childItem -path "$path" -Recurse  | Select-Object | Move-Item -Destination
    'C:\$Recycle.Bin'
    }
Bill Hileman
  • 2,798
  • 2
  • 17
  • 24
Cesar
  • 21
  • 5
  • the recycle bin is NOT a normal dir. [*grin*] just putting stuff directly in that dir does NOT make the item show up as a recycle bin item. think about it ... how is the system supposed to know where it came from? – Lee_Dailey Nov 12 '20 at 01:23
  • The Recycle Bin is not a regular folder, and you can't treat it as one. The OS performs tracking of files that are placed in the Recycle Bin, so that it can restore them to the original location if needed. You can do this with `IFileOperation` in the WinAPI; I'm not sure how to do it in Powershell, but what you're attempting will never work. – Ken White Nov 12 '20 at 01:30

0 Answers0