Search found 33 matches
- Mon Jul 09, 2018 10:47 am
- Forum: PowerShell
- Topic: year and countryname extract
- Replies: 22
- Views: 5376
Re: year and countryname extract
when i comment #Group-Object $Matches[1] | the query stopped giving error..do i have to define
- Mon Jul 09, 2018 10:16 am
- Forum: PowerShell
- Topic: year and countryname extract
- Replies: 22
- Views: 5376
Re: year and countryname extract
i tried again but not working $sourcedir = 'C:\Users\garang\Documents\input_files\Advisory_rate' $destdir = 'C:\Users\garang\Documents\input_files\Advisory_rate\Archive' Get-ChildItem -File -Path $sourcedir | Where-Object BaseName -match ' ([a-z]+_20\d{2})_\d' | Group-Object $Matches[1] | ForEach-Ob...
- Mon Jul 09, 2018 2:24 am
- Forum: PowerShell
- Topic: year and countryname extract
- Replies: 22
- Views: 5376
Re: year and countryname extract
i think you must understand you own login...or you do not know
- Mon Jul 09, 2018 2:09 am
- Forum: PowerShell
- Topic: year and countryname extract
- Replies: 22
- Views: 5376
Re: year and countryname extract
Get-ChildItem -File -Path $sourcedir|
select *, @{n='Year';e={($_.Basename -split '_')[2]}}
Group-Object Year |
ForEach-Object {
$_.Group | Sort-Object LastWriteTime -Descending |
Select-Object -First 1
}
how can this solve the purpose.. can you please explain
select *, @{n='Year';e={($_.Basename -split '_')[2]}}
Group-Object Year |
ForEach-Object {
$_.Group | Sort-Object LastWriteTime -Descending |
Select-Object -First 1
}
how can this solve the purpose.. can you please explain
- Mon Jul 09, 2018 2:00 am
- Forum: PowerShell
- Topic: year and countryname extract
- Replies: 22
- Views: 5376
Re: year and countryname extract
ok i am not the right person but can you give the logic in where or like condition for this or you do not know at all
so it should check the character between 1st space and 2nd '_' like Italy & year then last modified date
so it should check the character between 1st space and 2nd '_' like Italy & year then last modified date
- Mon Jul 09, 2018 1:35 am
- Forum: PowerShell
- Topic: year and countryname extract
- Replies: 22
- Views: 5376
Re: year and countryname extract
I am able to move the date based on year...but for the multiple country of same yearnot moving so wants join country also with it so the formula is country+ year + max(last modified date)..so it should find the character Mode Last Modified date Length Filename -a--- 6/25/2018 12:08 AM 31744 abc_Ital...
- Sun Jul 08, 2018 11:28 pm
- Forum: PowerShell
- Topic: year and countryname extract
- Replies: 22
- Views: 5376
Re: year and countryname extract
$sourcedir = 'C:\Users\garang\Documents\input_files\Advisory_rate' $destdir = 'C:\Users\garang\Documents\input_files\Advisory_rate\Archive' Get-ChildItem -File -Path $sourcedir| Where-Object BaseName -match '_(20\d{2})_\d' | Group-Object $Matches[1] | ForEach-Object { $_.Group | Sort-Object LastWri...
- Sun Jul 08, 2018 8:36 pm
- Forum: PowerShell
- Topic: year and countryname extract
- Replies: 22
- Views: 5376
Re: year and countryname extract
please help me with move script
- Sun Jul 08, 2018 1:33 pm
- Forum: PowerShell
- Topic: year and countryname extract
- Replies: 22
- Views: 5376
Re: year and countryname extract
these both name are same...and 2nd row file should go to archive..which is not happening Mode Last Modified date Length Filename -a--- 6/25/2018 12:08 AM 31744 abc Italy_2016_2 - Copy - Copy.xls -a--- 6/25/2018 12:07 AM 31744 abc Italy_2016_2 - Copy.xls
- Sun Jul 08, 2018 12:06 pm
- Forum: PowerShell
- Topic: year and countryname extract
- Replies: 22
- Views: 5376
Re: year and countryname extract
small correction, After first word of the file name does not contain '_' so difficult to find country and year order by and it is not select statement remaining file has to go to archive folder $dest. in the below case 2 nd row file should go to archive Mode Last Modified date Length Filename -a--- ...