Would be easier to copy everything over and then delete anything that isn’t 2007?
No, it would be absolute pain in the hole.
Plus bringing the whole folder across would cause space issues. The folders are fairly big.
I reckon I’m missing some switch in the move-item to recreate the folder structure at the other end.
Get-ChildItem –Path \server01\data\ -Include “2007” –Recurse | Move-Item -Destination \server02\Archive\
Robocopy using /MIR would give you the structure. Could you loop through the structure and if it hits a folder called 2007, mirror the folder to the new location.
Does this half of the command find the right folders?
get-childitem -path \server01\data\ -recurse | where {$_.Name -eq 2007}
Ya this half is finding the right folders
That could work, how would you loop through in Robocopy though? Or are you saying to use Robocopy first to create the structure, then use powershell to populate the 2007 folders.
Can you use a wildcard (in either robocopy/xcopy/powershell) to copy directories?
e.g. \server01\data \ *\2007
?
Try piping your first command there into a robocopy?
be careful using /MIR it can wipe the destination if you make a mistake
Wild cards can only be used in the source when they are used in the FileName. They can not be used in the Path (folder names)
It will be interesting tomorrow watching the news to see which commercial enterprise has a major systems failure and blames “hacking”
John is going to be seething when he loses all of his files in the migration.
Jesus H Christ. The last few posts has again reminded me that I need to get the fuck away from the freaks in the IT game.
awk is saving my ass tonight lads. I have 2 files with 9 million rows in each and I need to fine the differences between them
Was given my own office yesterday.
I have finally made it