如何通过Powershell中的扩展名列表分隔整个文件夹内容

时间:2019-02-24 08:41:28

标签: powershell

我有源文件夹,我想有2个文件夹,其结构与源文件夹相同,但一个文件夹仅包含文本文件,另一个文件夹仅包含二进制文件。事实是,由于某些原因,包括过滤器对我不起作用,两个目标文件夹都存在,并且在脚本运行期间我没有收到任何错误。我正在使用PS 5.1并以管理员身份运行此脚本。

export const getPatientById = id => dispatch => {
  dispatch(setPatientLoading());
  axios
    .get(`/api/patients/${id}`)
    .then(res => {
      dispatch({
        type: GET_PATIENTS_SINGLE,
        payload: res.data
      });
    })
    .catch(err => {
      dispatch({
        type: GET_ERRORS,
        payload: err.response.data
      });
    });
};

1 个答案:

答案 0 :(得分:0)

尝试一下:

$source = "C:\scr\*"
$destSourceCode = "C:\temp\"
$destBinaries = "C:\tempBin\"
$binariesExtentionList = @('*.jar','*.zip','*.so','*.class','*.dll')
#Copy SC
Copy-Item -Path ($source + '.*') -Destination $destSourceCode -Recurse -Force -Exclude $binariesExtentionList
#Copy Binaries
Copy-Item -Path $source -Destination $destBinaries -Recurse -Force -Include $binariesExtentionList 
Copy-Item -Path $source -Destination $destBinaries -Recurse -Force -Filter '*.'