Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7428109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:41:33+00:00 2026-05-29T08:41:33+00:00

I am looking to copy files from a directory structure over to a new

  • 0

I am looking to copy files from a directory structure over to a new folder. I am not looking to preserve the file structure, just get the files. The file structure is such that there can be nested folders, but anything in a folder named ‘old’ I do not want moved over.

I made a couple attempts at it, but my powershell knowledge is very limited.

Example being where the current file structure exists:

Get-ChildItem -Path "C:\Example\*" -include "*.txt -Recurse |% {Copy-Item $_.fullname "C:\Destination\"}

This gives me all the files all I want, including all the files I don’t want. I do not want to include any files that are in the ‘old’ folder. To note: there are multiple ‘old’ folders. I tried -exclude, but it looks like it only pertains to the file name, and I am not sure how to -exclude on a path name, while still copying the files.

Any help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T08:41:34+00:00Added an answer on May 29, 2026 at 8:41 am

    How about this:

    C:\Example*" -include "*.txt -Recurse |
      ?{$_.fullname -notmatch '\\old\\'}|
        % {Copy-Item $_.fullname "C:\Destination\"}
    

    Exclude everything that has ‘\old\’ anywhere in it’s path.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for batch to make directory with subdirectories from files names and copy
I am looking for a robust way to copy files over a Windows network
I am trying to copy a couple of image files from my MainBundle/SampleImages folder
Or should I just copy all the files from bin\Release\ excluding .pdb? UPD :
I'm looking to copy a row from one sheet to another based upon having
We're looking into running multiple instances of Tomcat from the same copy of the
Scenario: Repository structure changed from /trunk/ to /projectName/trunk/ and the local copy is outdated
I am looking for some documentation or tutorial for copying files from a given
I want to copy csv data from different files and then store in a
Using COPY statement of PostgreSQL, we can load data from a text file into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.