Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
新Powershell用户-从CSV导入导出,但仅在今天修改_Powershell_Csv - Fatal编程技术网

新Powershell用户-从CSV导入导出,但仅在今天修改

新Powershell用户-从CSV导入导出,但仅在今天修改,powershell,csv,Powershell,Csv,我知道这是不正确的,但我想使用csv作为要复制的文件的源和目标(这很好),但我还想添加逻辑,只有在今天修改的情况下才进行复制。下面是我想做的一个例子: $MyDate = (Get-Date).date Import-Csv Y:\copytest.csv | foreach {Copy-Item -Path $_.Source -Destination $_.Destination | Where {$_.lastwritetime -gt $MyDate } } 我猜我需要从$\

我知道这是不正确的,但我想使用csv作为要复制的文件的源和目标(这很好),但我还想添加逻辑,只有在今天修改的情况下才进行复制。下面是我想做的一个例子:

$MyDate = (Get-Date).date
Import-Csv Y:\copytest.csv | foreach {Copy-Item -Path $_.Source -Destination $_.Destination 
    | Where {$_.lastwritetime -gt $MyDate } }
我猜我需要从$\ux.Source激活实际文件,然后才能获得.lastwritetime任何帮助都将不胜感激


谢谢

用这个解决了这个问题$MyDate=(Get Date).Date写入主机$MyDate导入Csv Y:\copytest.Csv | foreach{if($(Get Item-Path$\源).lastwritetime-gt$MyDate){复制项-路径$\源-目标$\目标}将此作为答案发布,以便其他人可以从中受益!在注释中发布代码真的很糟糕-它无法正确格式化,而且很难阅读-请不要这样做!