Copy recursively a directory excluding a subdirectory and ITS CONTENT

user3602030

I found solutions, but this solutions don't exclude the content of the subdirectories excluded.

I want copy recursively a directory to another location, but excluding the subdirectory "Videos" and its content. The next command finish, but no exclude the subdirectory "Videos" and its content.

# PowerShell version: 4.0
# This command copy recursively the directory "J:\All" to "J:\Users\John\Desktop\my_backup", excluding "J:\All\Videos"
Copy-Item -Recurse -Path ("J:\All" | ? { $_.FullName -NotMatch ("^J:\\All\\Videos") }) "J:\Users\John\Desktop\my_backup"

Thank you!

alroc

RoboCopy is a better solution here. See https://superuser.com/questions/482112/using-robocopy-and-excluding-multiple-directories

robocopy J:\All J:\Users\John\Desktop\my_backup /MIR /XD j:\all\videos

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

puppet copy directory but not its content

From Dev

Lock or unlock a directory and its content recursively

From Dev

Copy the content/file to all subdirectory in a directory using terminal

From Dev

Robocopy copy directory instead of just its content

From Dev

How can I copy a hidden directory recursively and preserving its permissions?

From Dev

Copy and overwrite directory recursively

From Dev

move or copy a directory to a subdirectory of itself

From Dev

Copy history of subdirectory to parent directory

From Dev

Recursively copy file to a directory all its sub-directory in command prompt

From Dev

copy recursively except hidden directory

From Dev

Python: copy folder content recursively

From Dev

Python: copy folder content recursively

From Dev

Scan Directory and display subdirectory and its contents

From Dev

Find all files in a directory and its subdirectory

From Dev

I want to copy a directory excluding one file

From Dev

Recursively move files from subdirectory to folders in parent directory

From Dev

Recursively do something with all files in a given directory including subdirectory files

From Dev

Copy directory content

From Dev

Using grep to recursively search a directory for a pattern while excluding another pattern

From Dev

rsync certain files, excluding the rest, ignoring .svn/ directory, recursively

From Dev

How to copy matching files from directory/subdirectory to a another directory

From Dev

301 a directory URL and all of its contents to another excluding sub directory

From Dev

Recursively copy files from one directory to another

From Dev

Recursively copy files from one directory to another

From Dev

Symlink Copy a Directory Non-recursively

From Dev

Copy filenames, and add path prefix, in a directory, recursively

From Dev

Copy files from directory recursively smallest first

From Dev

Copy node and alter its content

From Java

Get the size of a directory (not its content)

Related Related

  1. 1

    puppet copy directory but not its content

  2. 2

    Lock or unlock a directory and its content recursively

  3. 3

    Copy the content/file to all subdirectory in a directory using terminal

  4. 4

    Robocopy copy directory instead of just its content

  5. 5

    How can I copy a hidden directory recursively and preserving its permissions?

  6. 6

    Copy and overwrite directory recursively

  7. 7

    move or copy a directory to a subdirectory of itself

  8. 8

    Copy history of subdirectory to parent directory

  9. 9

    Recursively copy file to a directory all its sub-directory in command prompt

  10. 10

    copy recursively except hidden directory

  11. 11

    Python: copy folder content recursively

  12. 12

    Python: copy folder content recursively

  13. 13

    Scan Directory and display subdirectory and its contents

  14. 14

    Find all files in a directory and its subdirectory

  15. 15

    I want to copy a directory excluding one file

  16. 16

    Recursively move files from subdirectory to folders in parent directory

  17. 17

    Recursively do something with all files in a given directory including subdirectory files

  18. 18

    Copy directory content

  19. 19

    Using grep to recursively search a directory for a pattern while excluding another pattern

  20. 20

    rsync certain files, excluding the rest, ignoring .svn/ directory, recursively

  21. 21

    How to copy matching files from directory/subdirectory to a another directory

  22. 22

    301 a directory URL and all of its contents to another excluding sub directory

  23. 23

    Recursively copy files from one directory to another

  24. 24

    Recursively copy files from one directory to another

  25. 25

    Symlink Copy a Directory Non-recursively

  26. 26

    Copy filenames, and add path prefix, in a directory, recursively

  27. 27

    Copy files from directory recursively smallest first

  28. 28

    Copy node and alter its content

  29. 29

    Get the size of a directory (not its content)

HotTag

Archive