Get-ChildItem to Move-Item - path not found
Posted
by Filburt
on Stack Overflow
See other posts from Stack Overflow
or by Filburt
Published on 2010-04-23T12:49:21Z
Indexed on
2010/04/23
14:33 UTC
Read the original article
Hit count: 228
powershell
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?
© Stack Overflow or respective owner