Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Time stamp in powershell

$
0
0

I want to copy two file with current time stamp with time format like this:  yyyy-mm-dd-hh-mm-ss

Example: mytestfile2014-11-26-00-10-45

The folder contains many files generated by date but I only want to copy the current one.:

$currentdate=[datetime]::Today.ToString('yyyy-MM-dd')

Copy-Item "mytestfile$currentdate_.csv" -destination "d:\New Folder"

 

But it just won't copy any file or the error says that  the file cannot  be found.

 

Need help.--Thanks!!



Viewing all articles
Browse latest Browse all 6937

Trending Articles