Get-OldestFile #
SYNOPSIS #
Get oldest filename from a directory
SYNTAX #
Get-OldestFile [[-path] <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>]
DESCRIPTION #
This function returns the oldest file of a folder. The parameter filemask
is specified with path and file mask.
EXAMPLES #
Example 1:Returns the oldest text file from a folder #
PS C:\> Get-OldestFile -filemask 'C:\temp\*.txt'
# Output
logo.txt
In this example the oldest text file from the folder C:\temp
is returned.
PARAMETERS #
-path #
Specifies the path, including the file mask, for which the oldest file should be found.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters #
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.