January 1, 2012 at 12:00 am #5159MemberPoints: 0Rank: Member
by nitewriter07 at 2012-10-01 14:50:57
I am new to Powershell. This seems to be the place to go... I hope.
I have a request for moving folders from one location to another on a regular basis.
Now this process is generally easy, although mind-numbingly exciting, but is there a way to do it in PowerShell that would allow me to also do other mind-numbing tasks at the same time 🙂 🙁
OK seriously. I have a listing of folders and file that gets emailed to me, generally in excel although I can certainly make it a txt file.
They are listed out by full UNC path so there are no hidden surprises (generally).
Is there a way I can utilize PowerShell to read that listing and move the folder and file to another location without copying folders individually?
The process can takes days since it is generally several hundred folders with log data and other bit included and the copy times are fairly slow since I am moving several TB a day in litigation data across many different servers from many different sources to a single location.
Any help would be greatly appreciated, indeed.
by JeffH at 2012-10-02 04:45:41
This shouldn't be too hard. You';ll need to know how to use Get-Content (assuming a text file which is the easiest) and Copy-Item. Roughly you could do something like this:
get-content myfiles.txt | copy-item -dest R:\MyDestination
But, there are ways to copy entire directory trees and recurse so it really depends on what is in your list. Look at help and examples for Copy-Item.
by nitewriter07 at 2012-10-02 08:39:34
Thank you. That seems really straight forward.
I am in fact looking to grab an entire directory such as:
and move it to a staging directory in the event that the data may already exist in the destination location.
I would imagine that it would be possible to have the script check the destination folder to ensure overwrites do not happen? Example is Source Folder: Matter1
Destination Folder: Matter1
If that seems complicated, it would certainly be easy to stage the data from the directory before placing it into its final destination.
Again. Thank you for taking a look.
The topic ‘Not a n00b but New to Powershell’ is closed to new replies.