Skip to content

Commit

Permalink
v2.0.0.1 (v2kiran#10)
Browse files Browse the repository at this point in the history
* changed directorysize cmdlet to ouptut psobject instead of hash

* added defaultpropertyset to dirsize

* added format definition. changed size header

* changed ceiling to round

* added destinationtype paramter to copy-item

* added sleep to delay between delete and copy

* changed alias to cmdlet

* updated help and change logs

* updated readme
  • Loading branch information
v2kiran authored May 21, 2017
1 parent 28b0a85 commit 2b5abef
Show file tree
Hide file tree
Showing 9 changed files with 2,981 additions and 552 deletions.
26 changes: 26 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "PowerShell",
"request": "launch",
"name": "PowerShell Launch (current file)",
"script": "${file}",
"args": [],
"cwd": "${file}"
},
{
"type": "PowerShell",
"request": "attach",
"name": "PowerShell Attach to Host Process",
"processId": "${command:PickPSHostProcess}",
"runspaceId": 1
},
{
"type": "PowerShell",
"request": "launch",
"name": "PowerShell Interactive Session",
"cwd": "${workspaceRoot}"
}
]
}
25 changes: 25 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
2.0.0.1

Sunday, May 21, 2017

-Copy-LongChildItem
-DestinationType
-Specify whether the destination is a file or a folder. If this parameter is not specified the destination type is inferred by checking whether the destination item has an extension or not.
If the destination has an extension then we assume it is a file and folder if not. As you can tell this is not always correct because there can be folders with a period in them which can then be incorrectly inferred as a file.
Hence it is important to specify this parameter to get accurate results.
-Get-LongDirectorySize
-Changed output object from a hashtable to custom PSOBJECT.
-Unit
-Specify the unit type for folder size : ('KB', 'MB', 'GB', 'TB', 'PB', 'Bytes' )
-IncludeSubfolder
-Specify this parameter to list the sizes of the subfolders including the parent

Feature Requests:
Issue 9 - List Size of all sub directories in Get-LongDirectorySize

Fixed Issues:
Issue 3 - Copy-LongItem over the top of an existing file
Issue 4 - Copy-LongItem when destination is a folder path
Issue 6 - You cannot call a method on a null-valued expression


v2.0.0.0
- Major Release with numerous improvements and enhancements
- Module is now compatible with PS v3
Expand Down
96 changes: 50 additions & 46 deletions Examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,33 @@ SYNOPSIS
This command copies the drivers.txt file to the C:\temp\folder1 directory. 'folder1' is created if it dosent exist.
-------------------------- EXAMPLE 2 --------------------------

PS C:\>Copy-LongItem C:\temp\logfiles -Destination C:\temp\newlogs
PS C:\>Copy-LongItem C:\temp\logfiles\ -Destination C:\temp\newlogs -Verbose


This command copies the contents of the C:\Logfiles directory recursively to the C:\temp\newLogs directory. It creates the \newLogs subdirectory if it does not already exist.
-------------------------- EXAMPLE 3 --------------------------

PS C:\>Copy-LongItem C:\temp\logfiles -Destination C:\temp\newlogs -Verbose


This command copies the entire folder C:\Logfiles recursively to the C:\temp\newLogs. It creates the "newLogs" subdirectory if it does not already exist.
-------------------------- EXAMPLE 4 --------------------------

$params =
@{
Path = 'C:\temp\test-psalphafs\source\file-01.txt'
Destination = 'C:\temp\test-psalphafs\destination.dir1'
Force = $false
verbose = $true
destinationtype = 'Directory'
}

Copy-LongItem @params

We use "splatting" to pass the parameters as a table to copy-longitem. file 'file-01.txt' is copied to destination directory 'destination.dir1'. The destination directory 'destination.dir1' will be created if it dosent already exist.

Note: The destination "destination.dir1" is a folder containing a period in its name and hence we also specify the "destinationtype" parameter.
If destinationtype parameter is not specified the destination would be treated as a file.
-------------------------- EXAMPLE 3 --------------------------

PS C:\>Copy-LongItem -Path C:\temp\win2012R2.iso -Destination C:\temp\2012R2.iso -Verbose -NoBuffering
Expand Down Expand Up @@ -149,58 +172,39 @@ SYNOPSIS

-------------------------- EXAMPLE 1 --------------------------

PS C:\>Get-LongDirectorySize -Path D:\Github -Recurse

Key Value
--- -----
Archive 321
Compressed 0
Device 0
Directory 201
Encrypted 0
Hidden 1
IntegrityStream 0
Normal 0
NoScrubData 0
NotContentIndexed 0
Offline 0
ReadOnly 264
ReparsePoint 0
SparseFile 0
System 0
Temporary 0
File 321
Total 522
Size 3069696
SizeinMB 3


Gets the directory statistics for D:\Github, optionally enumerating the subfolders and files.
-------------------------- EXAMPLE 2 --------------------------

PS C:\>Get-LongDirectorySize -ContinueonError


Enumerates the files and folders in the current directory, and will ignore any exceptions\errors that may arise due to access or other issues.
Warning: using the -ContinueonError may result in an incorrect directory size.
-------------------------- EXAMPLE 3 --------------------------
PS C:\>Get-LongDirectorySize -Path c:\temp

Path Size Directory File Hidden Count
---- ---- --------- ---- ------ -----
c:\temp 49337903 35 67 0 102

PS C:\>$githubDIR = Get-LongDirectorySize D:\Github -Recurse

$githubDIR.Size
3069696
Gets the directory statistics for c:\temp. Since the Unit size parameter was not specified the size of the folder is in "bytes".
-------------------------- EXAMPLE 2 --------------------------

$githubDIR.SizeinMB
3
PS C:\>Get-LongDirectorySize -Path c:\temp -Recurse -ContinueonError

Path Size Directory File Hidden Count
---- ---- --------- ---- ------ -----
c:\temp 7855289946 2087 4985 18 7072

PS C:\temp\dsc>

List the aggregate size of all the files and folders in the temp directory, and will ignore any exceptions\errors that may arise due to access or other issues.
Warning: using the -ContinueonError may result in an incorrect directory size.

-------------------------- EXAMPLE 3 --------------------------

The first command assigns the out of the cmdlet Get-LongDirectorySize to the variable github
the second command is used to access the size of the directory in bytes.
the third command lists the size in megabytes.
PS C:\>Get-LongDirectorySize -Path c:\temp -Recurse -IncludeSubfolder -Unit MB

Note: the unit of size kb\mb\gb\tb will change based on the size of the directory.
Path Size Directory File Hidden Count
c:\temp 7491 2084 4978 18 7062
c:\temp\.vscode 0 0 2 0 2
c:\temp\123 0 3 0 0 3
c:\temp\234 0 2 1 0 3
c:\temp\alpha1 1 4 7 0 11

Recursively list the total size of the temp folder along with the sizes of all the subfolders. The size of the folders are calulated in megabytes.


NAME
Get-LongDiskDrive
Expand Down
Loading

0 comments on commit 2b5abef

Please sign in to comment.