Windows Thread, PowerShell Script to Move files. in Technical; Hi, I was wondering is someone knew of a script I could use to move certain files within a host ...
1. ## PowerShell Script to Move files.

Hi,

I was wondering is someone knew of a script I could use to move certain files within a host of directories. IE move all of the .mp3 files from student areas.

I'm working with this so far, but it's not working.

get-childitem -path "c:\from" -recurse -include *.mp3 | move-item -force -destination "C:\to"

Any tips?

Thanks,

Viktor.

2. What's not working exactly?

Code:
get-childitem -path "c:\test\1" -recurse -include *.mp3 | move-item -force -destination "C:\test\2"
Moves all of 1 to 2.

Steve

3. Well running this

Code:
get-childitem -path "c:\from" -recurse -include *.mp3 | move-item -force -destination "C:\to"
does not copy all the .mp3 files across, it seems to miss alot. There are files that it does not copy, even though they're mp3 files.

I'd also like to to maintain the structure..

IE

c:\From\DSmith\music.mp3

to

In this example the DSmith folder would have lots of other files in, i'd just like to move the mp3 files (and likely other files as well .wma .gba etc...)

Hope this makes more sense.

Viktor.

4. Well few things that spring to mind,

Do the files have weird chars in that might be escaping the strings? e.g. []%/ etc?

Are they external-zoned files? (When you look in properties do they have the "unlock" option?

etc.

Steve

SHARE: