Created
July 1, 2020 06:15
-
-
Save morriekken/118534adfefd84ef1ab5443e035fd2f1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Count files in current dir and all subdirectories | |
(Get-ChildItem *.jpg -Recurse -File | Measure-Object).Count | |
# Measure size of files in current directory and all subdirectories (in Gb) | |
(Get-ChildItem *.jpg -Recurse -File | Measure-Object -Property Length -Sum).Sum / 1Gb | |
# Get 100 random jpg files and exclude FOLDER (you have to provide CountOfFiles) | |
Get-ChildItem -Exclude FOLDER | Get-ChildItem -Recurse -Filter *.jpg -File | Get-Random -Count CountOfFiles | Select-Object -First 100 | |
# Same as above but copies selected files to DESTINATION_FOLDER | |
Get-ChildItem -Exclude FOLDER | Get-ChildItem -Recurse -Filter *.jpg -File | Get-Random -Count CountOfFiles | Select-Object -First 100 | Copy-Item -Destination DESTINATION_FOLDER |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment