Jump to content

Recommended Posts

Posted
So, a load of our students have just sat an exam, and I want to copy a specific sub-folder out of each of their My Documents folders. The folder path is \\SERVER\Users\Exams\Name\Exam-XXXX-Work (where XXXX is their candidate number). Can anyone suggest a script which would trawl the "Exams" folder and copy all the Exam-XXXX-Work folders out into one folder, so I can burn them to disc? There's nearly 200 students, so I don't really fancy doing this manually...
Posted
might be quicker to just sit ona pc that can access the parent folder and search then copy the results to where they are needed
  • Thanks 1
Posted (edited)

I've tried this Powershell on a basic test and it seems to work.

Get-ChildItem -Path "\\SERVER\Users\Exams" -Recurse | where {{$_.PSIsContainer} -and {{$_.Name -like "exams-*"} -and {$_.name -like "*-work"}}} | Copy-Item  -Destination "c:\temp" -Force -Recurse

Edited by jinnantonnixx
Updated - had a bug
Posted
might be quicker to just sit ona pc that can access the parent folder and search then copy the results to where they are needed

 

Of course. I didn't think about copying from a search results list. Sometimes it is the simple answers which evade us, isn't it. Thanks!

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