Resolving error in move-item powershell command

174 Views Asked by At

I am trying to write a short powershell MOVE-ITEM command that takes rows of data from a CSV and moves the file from the folder it is in to a separate folder (which already exists).

I've looked at various examples and I think I'm pretty close but I'm getting an error when I run the command. The error is illustrated below:

MOVE-ITEM : Cannot find path 'C:\Users\blank\Downloads\move-files-test-area\@{Filename=Testdoc1}' because it does not exist.

I'm actioning this from within the directory and I'm obviously missing one piece that cleans up the MOVE-ITEM file path but I can't fathom what it is.

The command in full is:

IMPORT-CSV -PATH process-docs.csv -ERRORACTION STOP | foreach {MOVE-ITEM -PATH $_ -DESTINATION \to-here\ }

What blindly obvious thing am I missing? I don't use powershell often but I have 100k files to sort from a separate set of 400k files and I have no wish to handle it manually so I've been exploring the MOVE-ITEM command to aid me.

To confirm, I'm running this in Windows Powershell just in case that has any importance for suggestions.

Thanks for any help on this.

0

There are 0 best solutions below