Adding a file name prefix for mass documents using Powershell

We receive zip files regularly that contain folders, documents (of all kinds (pdf, docx, etc.) and subfolders with documents.  Once we receive them, I have to extract the zip and then rename the files to meet our naming conventions.  What I have been using is Powershell but I am having problems.  Can someone tell me how to exclude renaming the folder?  For example.
I have a folder named "test".  Within this folder, I have 30 documents and 4 subfolders (that also contain documents).  I'm using the powershell script to add a prefix, dir | Rename-Item -NewName {"%Prefix%" + " - " + $_.Name}.  When I run this command, it renames the files perfectly but it also renaming the subfolders.  How do I exclude renaming the sub folder?

Also, it only renames the files in the parent "test" folder.  It does not rename the files in the subfolders.  Is there a way to make it rename the files only in the subfolders as well without having to go to each subfolder?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Just pass "dir" (an alias for GetChildItem, btw.) the arguments -File to only return files instead of files and directories, and -Recurse to process subfolders
dir -File -Recurse  | Rename-Item -NewName {"%Prefix%" + " - " + $_.Name}

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tmartin40Author Commented:
That worked perfectly, Thanks!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.