- $srcDir = 'E:\Test'; #源目录
- $dstDir = 'D:\Mydir';#目标目录
-
- dir -Literal $srcDir -Include *.* -Recurse | ?{$_ -is [IO.FileInfo] -and ($_.LastWriteTime-(Get-Date)).Days*($_.CreationTime-(Get-Date)).Days -eq 0} | ForEach{
- $strFolder = $dstDir + $_.DirectoryName.SubString(2);
- if(![IO.Directory]::Exists($strFolder)){
- $null = New-Item $strFolder -ItemType directory -Force;
- }
- copy -Literal $_.FullName -Dest ($strFolder + '\');
- }
复制代码
|