Hi I have a Problem with adding a time to a filename and move it then.
Here is what I'm doing:
$currentTime=(Get-Date -Format T) $currentFile=($currentSam+$currentTime+".htm") Rename-Item $fileName -NewName $currentFile move-item $currentFile $dateDirName Error: FILE TestUser109:57:21.htm Rename-Item : Cannot rename because the target specified represents a path or device name. At C:\Users\Administrator\Desktop\Rewe-Working Script\ReweMailCustomScriptV1.0.ptxt.ps1:384 char:6 + Rename-Item $fileName -NewName $currentFile+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : InvalidArgument: (:) [Rename-Item], PSArgumentException+ FullyQualifiedErrorId : Argument,Microsoft.PowerShell.Commands.RenameItemCommand Line 384 is the Rename line: Rename-Item $fileName -NewName $currentFile
Can someone please help? Thanks!