2014-07-11 43 views
3

我有没有文件扩展名的文件。我如何在PowerShell中移动它们?powershell移动文件类型.file

下面是我有:

$backupPATH = new-item -ItemType directory C:\Users\user\Desktop\location\$(get-date -f MM-dd-yyyy_HH_mm_ss) 
$date = (get-date).AddDays(-60) 
get-childitem -Path C:\Users\user\Desktop\test1 *.tsv | 
where-object {$_.LastWriteTime -lt $date} | 
move-item -destination $backupPATH 

下面是脚本移动文件没有扩展,但不知道从哪里开始。

get-childitem -Path C:\Users\user\Desktop\test1 | 
where-object {$_.LastWriteTime -lt $date} | 
move-item -destination $backupPATH 

回答

2

刚上的文件,其Extension属性过滤器是空的:

get-childitem -Path C:\Users\user\Desktop\test1 | 
where-object {$_.LastWriteTime -lt $date -and -not $_.Extension} | 
move-item -destination $backupPATH 
+0

这里是** **电源的外壳:) – MrPaulch

+0

是的!像魅力一样工作。非常感谢! :) – user3829304

相关问题