How to select files by date and copy them?


can me translate cygwin bash powershell?

/usr/bin/find . -type f -newerct '2 day ago'  ! -newerct '1 days ago' -exec cp {} e\:/ \;

this script finds files in current directory older 1 day , younger 2 days old copies them e drive. how do in powershell?

thanks!

siegfried


siegfried heintze

$min = (get-date).adddays(-1) $max = (get-date).adddays(-2) get-childitem | ? {$_.lastaccesstime -le $min -and $_.lastaccesstime -ge $max }

get-childitem | ? {$_.lastaccesstime -le $min -and $_.lastaccesstime -ge $max } | % {copy-item  $_.fullname e:\ }



life short, enjoy cyreli







Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Error: 0x80073701 when trying to add Print Services Role in Windows 2012 Standard

Disconnecting from a Windows Server 2012 R2 file sharing session on a Windows 7,8,10 machine

Event ID 64,77,1008 Certificates Events Windows Server 2008, 2008R2