+ Post New Thread
Results 1 to 4 of 4
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. #1

    Join Date
    Sep 2012
    Posts
    11
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    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. #2

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,689
    Thank Post
    334
    Thanked 515 Times in 483 Posts
    Rep Power
    179
    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. #3

    Join Date
    Sep 2012
    Posts
    11
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    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

    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.
    Last edited by VictorK; 16th October 2013 at 01:42 PM.

  4. #4

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,689
    Thank Post
    334
    Thanked 515 Times in 483 Posts
    Rep Power
    179
    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:
+ Post New Thread

Similar Threads

  1. Replies: 9
    Last Post: 17th October 2012, 12:48 PM
  2. Replies: 2
    Last Post: 8th March 2008, 02:18 PM
  3. Replies: 0
    Last Post: 24th January 2008, 02:58 PM
  4. Replies: 19
    Last Post: 20th June 2006, 03:53 PM
  5. script to copy files to machines
    By browolf in forum Scripts
    Replies: 1
    Last Post: 28th November 2005, 10:28 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •