Monday, October 08, 2007

The Powershell

On of the nice things I have found useful with the powershell, is the resiliency it provides over a command prompt.
 
A while ago I was copying some directory structures that have some archaic deny permissions set here and there.  In a scramble (You can tell this environment is organized, can't you?) to copy the folder structure and files, I did something like:
 
xcopy c:\FolderParent\* e:\NewFolder\ /E
 
Unfortuneately, at the first access-denied problem, the copy process gets aborted.  Nor does any information get displayed about where the copy stopped.
 
The Powershell allows you to do something like:
 
copy-item c:\FolderParent\ e:\NewFolder\ -recurse
 
This will output any errors in red (by default) but continue on copying the rest of the data (which is listed by default).  You can also tack on the -exclude command to leave out files AND folders that have the specified string (like *.txt).
 
Now if I take the time, I should be able to doctor up a nice master script that will output a complete log, and an estimated time to copy x GBs !

No comments: