I have a requirement to exclude files based on year, country name and last modified date from that particular year and rest files from that particular year and the country moved to an archive folder
for an example
- SS_MM_Master_finland_2018.xlsx last modified date 27/06/2018 19:00.
- SS_MM_Master_finland_2017.xlsx last modified date 27/06/2017 19:00.
in this case, same country and year is different in the file name so that particular year- last modified date would be excluded so both the files will be excluded
wants to know if someone can give a small example based on their experience...not necessary to be from above example or any multiple exclude rule or anything contribution would be appreciated
funny thing is that i have only single file excluder statement and do not know the multiple file excluder rule based on file name, Any example appericiated
I have only single file exclude statement
$sourcedir = 'C:TestCountry'
$destdir = 'C:TestCountryArchive'
Get-ChildItem -File -Path $sourcedir |
Sort-Object -Property LastWriteTime -Descending |
Select-Object -Skip 1 |
Move-Item -Destination $destdir -force
thanks
See Question&Answers more detail:os