enjay Posted January 17, 2014 Posted January 17, 2014 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...
sted Posted January 17, 2014 Posted January 17, 2014 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 1
jinnantonnixx Posted January 17, 2014 Posted January 17, 2014 (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 January 17, 2014 by jinnantonnixx Updated - had a bug
enjay Posted January 17, 2014 Author Posted January 17, 2014 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!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now