Updated version of the script here

This script allows you to delete remote Recycle Bin items (in a shared folder).
It can be very useful and interesting if you run it on a file server where the user home drives are defined.

Script :



Get the items and child items in a folder or registry key. (dir / ls / gci)

Standard Aliases for Get-ChildItem: dir, list, ls, gci

When listing files and sub-directories, get-childitem will return the mode (attributes), last write time, file size (length), and the filename.
Valid modes (attributes) are: d (directory), a (archive), r (read-only), h (hidden), and s (system).

The default path is the current directory ‘ . ‘
To specify all the items in the current directory use ‘*’


When listing a single folder (without recursion), you can do get-childitem c:\music\*.mp3
Unlike the CMD shell, in PowerShell the path filter of c:\music\*.mp3 is applied only to files not folders (or other containers)
The way to apply a wildcard recursively to a whole tree of items in PowerShell is to use the -include parameter:
get-childitem c:\music\ -include *.mp3 -recurse

This change in syntax was required because some providers (such as the registry provider) allow backslashes in a value name, separating the -path from the -include string makes it possible to use get-childitem against any provider: files, registry, processes etc.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Social Media Auto Publish Powered By : XYZScripts.com
%d bloggers like this: