Command line to delete matching files and directories recursively

后端 未结 6 1654
-上瘾入骨i
-上瘾入骨i 2020-12-12 14:21

How can I recursively delete all files & directories that match a certain pattern? e.g. remove all the \".svn\" directories and the files they contain?

(Sadly DO

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-12 14:50

    If you want to copy it without exporting and eliminating the .svn from the projects, you shold use the /EXCLUDE option from XCOPY.

    Like this:

    xcopy /S/Q/EXCLUDE:svn.excludelist [path_from] [path_to\]
    

    Observe the "\" (backslash) on the [path_to]. It determines that it's an output directory, so, xcopy will not question if it's a file or a directory.

    The svn.excludelist is a text file containing the patterns to ignore on copy separated by line.

    For Example:

    .svn
    .svn\
    \.svn\
    .obj
    .o
    .lib
    \src\
    

    And so on...

提交回复
热议问题