I am moving the files which are less than last modified date file to the Archive folder
but I wanted to put parameter and not to move the files to archive
which country wise max year and max modified date for an example
file1_itlay_2017.xlsx last modified date is 26/6/2018 10:24 AM
file1_itlay_2018.xlsx last modified date is 26/6/2018 10:24 AM
in this case it should fetch country,year and last modified date for that partucular year
so in output both file will be excluded
Requirement:exlcude file via year,country and last modfied date
i can able to achieve last modified date from below mentioned syntax
$sourcedir = ‘C:\Users\garang\Documents\input_files\Advisory_rate’
$destdir = ‘C:\Users\garang\Documents\input_files\Advisory_rate\Archive’
Get-ChildItem -File -Path $sourcedir |
Sort-Object -Property LastWriteTime -Descending |
Select-Object -Skip 1 |
Move-Item -Destination $destdir -force