Now, New-TemporaryFile cmdlet creates path to a temporary file. Sometimes we want to have path to a temporary directory.
Proposal is to add a Directory switch to get path to new temporary directory.
I've also needed this.
I think the name would become (eg) New-TemporaryItem. Or perhaps add a -Temporary switch to the existing New-Item and let the provider figure out what that means.
I can agree that New-Item -Temporary would work, it is not quite as obvious as New-TemporaryFile, New-TemporaryDirectory, or even New-TemporaryItem.
Adding this to New-Item should allow for temporary files and directories to be created on a -Path other than the platform "temp" directory. If -Path is not specified, the provider should know the platform "temp" directory.
@iSazonov Should we mark this as blocked due to https://github.com/dotnet/corefx/issues/24001 as welll?
The .Net team has now created a new tracking issue as they are now committed to implementing various improvements to the temp file APIs that will cover this. We can expect this to be available in .net 5
https://github.com/dotnet/runtime/issues/2048
Most helpful comment
I've also needed this.
I think the name would become (eg)
New-TemporaryItem. Or perhaps add a-Temporaryswitch to the existingNew-Itemand let the provider figure out what that means.