Total beginner. I am learning Powershell bit by bit as the need arises.

Trying to organize all files in one folder to another with a new sub-folder structure. I have a list of all the files with paths in the old folder, and I have assigned the new path and sub-folder to which each file must move. I am testing a script by trying to move one file at a time to get the hang of the right syntax. This one is not working.

Get-ChildItem –Path C:\Users\TOM\Documents\HouseBuy\pigsty.docx | Move-Item -Destination C:\Users\TOM\Documents\HomeReno\

Can someone please help by picking this apart and telling me the right syntax?

8 Spice ups

I think a good option here is either to use get-content or import-csv. In my example, I’m using get content and a TXT file instead of a word DOC.
Get-content is piped to foreach-object which moves each file.

The example of the contents of the TXT would look like so:

C:\path\filename.txt
C:\path\filename1.jpg
C:\path2\filename.pdf

get-content 'C:\Users\TOM\Documents\HouseBuy\pigsty.txt' | % {Move-Item $_ -Destination C:\Users\TOM\Documents\HomeReno\}

Welcome to the community. If you run this by itself, do you get an output?

Get-ChildItem –Path C:\Users\TOM\Documents\HouseBuy\pigsty.docx

Does the destination path already exist? You can verify it by running this:

Test-Path -Path "C:\Users\TOM\Documents\HomeReno\"