Jump to content

Recommended Posts

Posted

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.

Posted

What's not working exactly?

 

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

 

Moves all of 1 to 2.

 

Steve

Posted (edited)

Well running this

 

 

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

 

c:\To\DSmith\music.mp3 (instead of c:\To\music.mp3)

 

 

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.

Edited by VictorK
Posted

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...