< Back
Get-GcsObject
Post
NAME Get-GcsObject
SYNOPSIS
Get-GcsObject returns Google Cloud Storage Objects and their metadata. (Use Read-GcsObject to get its contents.)
SYNTAX
Get-GcsObject [[-Bucket] <string>] [[-ObjectName] <string>] [-Prefix <string>] [-Delimiter <string>]
[<CommonParameters>]
DESCRIPTION
Given a Google Cloud Storage Bucket, returns Google Cloud Storage Objects and their metadata.
If no parameter besides -Bucket is provided, all objects in the bucket are returned. If a given prefix string is
provided, returns all Cloud Storage objects identified by the prefix string.
An optional delimiter may be provided. If used, will return results in a directory-like mode, delimited by the
given string. This means that the names of all objects returned will not, aside from the prefix, contain the
delimiter. For example, with objects "1", "2", "subdir/3", "subdir/subdir/4", if the delimiter is "/", only "1"
and "2" will be returned. If the delimiter is "/" and the prefix is "subdir/", only "subdir/3" will be returned.
To gets a specific Cloud Storage Object by name, use the -ObjectName parameter. This parameter cannot be used
together with -Prefix and -Delimiter parameters.
If this cmdlet is used when PowerShell is in a Google Cloud Storage Provider location (i.e, the shell's location
starts with gs:\\), then you may not need to supply -Bucket. For example, if the location is gs:\\my-bucket, the
cmdlet will automatically fill out -Bucket with "my-bucket". If -Bucket is still used, however, whatever value
given will override "my-bucket". If the location is inside a folder on Google Cloud Storage, then the cmdlet will
prefix the name of the folder to -ObjectName if -ObjectName is used. If -ObjectName is not used, the cmdlet will
use the name of the folder as a prefix by default if -Prefix is not used or prefix the folder name to -Prefix if
-Prefix is used.
PARAMETERS
-Bucket <string>
Name of the bucket to check. Will also accept a Bucket object.
Required? false
Position? 0
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false
-ObjectName <string>
Name of the object to inspect.
Required? false
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Prefix <string>
Object prefix to use. e.g. "/logs/". If not specified all objects in the bucket will be returned.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Delimiter <string>
Returns results in a directory-like mode, delimited by the given string. e.g. with objects "1, "2", "subdir/3"
and delimited "/", "subdir/3" would not be returned.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
System.String
Name of the bucket to check. Will also accept a Bucket object.
OUTPUTS
Google.Apis.Storage.v1.Data.Object
---------- EXAMPLE 1 ----------
PS C:\\> Get-GcsObject -Bucket "widget-co-logs" -ObjectName "log-000.txt"
Get the object name "log-000.txt" and their metadata.
---------- EXAMPLE 2 ----------
PS C:\\> Get-GcsObject -Bucket "widget-co-logs"
Get all objects in a storage bucket.
---------- EXAMPLE 3 ----------
PS C:\\> Get-GcsObject -Bucket "widget-co-logs" -Prefix "pictures/winter" -Delimiter "/"
Get all objects in a specific folder Storage Bucket.
Because the Delimiter parameter was set, will not return objects under "pictures/winter/2016/". The search will
omit any objects matching the prefix containing the delimiter.
---------- EXAMPLE 4 ----------
PS C:\\> Get-GcsObject -Bucket "widget-co-logs" -Prefix "pictures/winter"
Get all objects in a specific folder Storage Bucket. Will return objects in pictures/winter/2016/.
Because the Delimiter parameter was not set, will return objects under "pictures/winter/2016/".
---------- EXAMPLE 5 ----------
PS C:\\> cd gs:\\my-bucket\\my-folder
PS gs:\\my-bucket\\my-folder> Get-GcsObject -ObjectName "Blah.txt"
Get the object Blah.txt in folder "my-folder" in bucket "my-bucket". This has the same effect as "Get-GcsObject
-Bucket my-bucket -ObjectName "my-folder/Blah.txt"
RELATED LINKS
SYNOPSIS
Get-GcsObject returns Google Cloud Storage Objects and their metadata. (Use Read-GcsObject to get its contents.)
SYNTAX
Get-GcsObject [[-Bucket] <string>] [[-ObjectName] <string>] [-Prefix <string>] [-Delimiter <string>]
[<CommonParameters>]
DESCRIPTION
Given a Google Cloud Storage Bucket, returns Google Cloud Storage Objects and their metadata.
If no parameter besides -Bucket is provided, all objects in the bucket are returned. If a given prefix string is
provided, returns all Cloud Storage objects identified by the prefix string.
An optional delimiter may be provided. If used, will return results in a directory-like mode, delimited by the
given string. This means that the names of all objects returned will not, aside from the prefix, contain the
delimiter. For example, with objects "1", "2", "subdir/3", "subdir/subdir/4", if the delimiter is "/", only "1"
and "2" will be returned. If the delimiter is "/" and the prefix is "subdir/", only "subdir/3" will be returned.
To gets a specific Cloud Storage Object by name, use the -ObjectName parameter. This parameter cannot be used
together with -Prefix and -Delimiter parameters.
If this cmdlet is used when PowerShell is in a Google Cloud Storage Provider location (i.e, the shell's location
starts with gs:\\), then you may not need to supply -Bucket. For example, if the location is gs:\\my-bucket, the
cmdlet will automatically fill out -Bucket with "my-bucket". If -Bucket is still used, however, whatever value
given will override "my-bucket". If the location is inside a folder on Google Cloud Storage, then the cmdlet will
prefix the name of the folder to -ObjectName if -ObjectName is used. If -ObjectName is not used, the cmdlet will
use the name of the folder as a prefix by default if -Prefix is not used or prefix the folder name to -Prefix if
-Prefix is used.
PARAMETERS
-Bucket <string>
Name of the bucket to check. Will also accept a Bucket object.
Required? false
Position? 0
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false
-ObjectName <string>
Name of the object to inspect.
Required? false
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Prefix <string>
Object prefix to use. e.g. "/logs/". If not specified all objects in the bucket will be returned.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Delimiter <string>
Returns results in a directory-like mode, delimited by the given string. e.g. with objects "1, "2", "subdir/3"
and delimited "/", "subdir/3" would not be returned.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
System.String
Name of the bucket to check. Will also accept a Bucket object.
OUTPUTS
Google.Apis.Storage.v1.Data.Object
---------- EXAMPLE 1 ----------
PS C:\\> Get-GcsObject -Bucket "widget-co-logs" -ObjectName "log-000.txt"
Get the object name "log-000.txt" and their metadata.
---------- EXAMPLE 2 ----------
PS C:\\> Get-GcsObject -Bucket "widget-co-logs"
Get all objects in a storage bucket.
---------- EXAMPLE 3 ----------
PS C:\\> Get-GcsObject -Bucket "widget-co-logs" -Prefix "pictures/winter" -Delimiter "/"
Get all objects in a specific folder Storage Bucket.
Because the Delimiter parameter was set, will not return objects under "pictures/winter/2016/". The search will
omit any objects matching the prefix containing the delimiter.
---------- EXAMPLE 4 ----------
PS C:\\> Get-GcsObject -Bucket "widget-co-logs" -Prefix "pictures/winter"
Get all objects in a specific folder Storage Bucket. Will return objects in pictures/winter/2016/.
Because the Delimiter parameter was not set, will return objects under "pictures/winter/2016/".
---------- EXAMPLE 5 ----------
PS C:\\> cd gs:\\my-bucket\\my-folder
PS gs:\\my-bucket\\my-folder> Get-GcsObject -ObjectName "Blah.txt"
Get the object Blah.txt in folder "my-folder" in bucket "my-bucket". This has the same effect as "Get-GcsObject
-Bucket my-bucket -ObjectName "my-folder/Blah.txt"
RELATED LINKS