• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 493
  • Last Modified:

Powershell command that will move based on ownership and file type

Need a command (doesn't HAVE to be PowerShell) that will find all Microsoft Office files  in a folder and all subfolders owned by a specific user and then move them to another location.

I know that I will probably have to run the command over each team with a different extension such as .doc, .xls.

So far I have a powershell command that will do everything except find the files by type. I have the following command:

Get-Children -recurse d:\foldername | get-acl | where {$_.Owner -match "username" } | Move-Item -Destination "h:\foldername" -recurse
1 Solution
Get-Children d:\foldername  -recurse  -include *.doc, *.xls, *.ppt, *.mdb| get-acl | where {$_.Owner -match "username" } | Move-Item -Destination "h:\foldername" -recurse 

Open in new window

Just add an include to your gci call
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

WEBINAR: GDPR Implemented - Tips & Lessons Learned

Join the WatchGuard team on Thursday, March 29th as we recount some valuable lessons learned in weighing the needs of a business against the new regulatory environment, look ahead at the two months left before implementation, and help you understand the steps you can take today!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now