Get-ChildItem to Move-Item - path not found
- by Filburt
I try to move my old logfiles to a yyyy\MM\dd folder structure by
Get-ChildItem . -Recurse -Include *.log |
Move-Item -Dest {"D:\Archive\{0:yyyy\\MM\\dd}\{1}" -f $_.LastWriteTime, $_.Name} -Force
but i get a path-not-found error.
update
I suspect the problem originates from the fact that the source path contains Program Files.
sub question: Could the same be done without Get-ChildItem?