Search found 33 matches

by sshree43
Thu Jul 12, 2018 9:41 am
Forum: Windows PowerShell
Topic: split satement
Replies: 10
Views: 1274

Re: split satement

can anyone extract year and country name from file name in my script
by sshree43
Wed Jul 11, 2018 10:44 pm
Forum: Windows PowerShell
Topic: split satement
Replies: 10
Views: 1274

Re: split satement

can you help in adding logic into it...believe me it is final $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-...
by sshree43
Wed Jul 11, 2018 2:18 pm
Forum: Windows PowerShell
Topic: split satement
Replies: 10
Views: 1274

Re: split satement

very simple question needs to extract year and country from file name and keep their last modified date files and move remaining files to archive...simple English
by sshree43
Wed Jul 11, 2018 1:44 pm
Forum: Windows PowerShell
Topic: split satement
Replies: 10
Views: 1274

Re: split satement

Hi expert, can you help in adding above logic into it $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 {...
by sshree43
Wed Jul 11, 2018 11:28 am
Forum: Windows PowerShell
Topic: split satement
Replies: 10
Views: 1274

Re: split satement

i got new logic into it

$Match = "[^_]+_[0-9]{4}"
$Lines = get-clipboard
$Results = $Lines | %{$_ -Match $Match | %{$Matches[0]}}
by sshree43
Wed Jul 11, 2018 9:53 am
Forum: Windows PowerShell
Topic: split satement
Replies: 10
Views: 1274

Re: split satement

at least tell me about match condition

Where-Object BaseName -match ' ([a-z]+_20\d{2})_\d' |
by sshree43
Wed Jul 11, 2018 9:29 am
Forum: Windows PowerShell
Topic: split satement
Replies: 10
Views: 1274

Re: split satement

Dear Sir,

My apology for guessing
the same thing i can achieve through Group-Object {$_.Basename.Split(' ')[3],('_')[1]} this script..can we able to split only country and year only without hardcoded
by sshree43
Wed Jul 11, 2018 6:11 am
Forum: Windows PowerShell
Topic: split satement
Replies: 10
Views: 1274

split satement

Hi Expert, I am using split condition to split the space and underscore and I am reaching to country and year but i wanted to stop after that i tried Group-Object {$_.Basename.Split(' ')[3],('_')[1]} | in this way i can get countryname _year but how to stop after the year and should not go further s...
by sshree43
Wed Jul 11, 2018 2:19 am
Forum: Windows PowerShell
Topic: year and countryname extract
Replies: 22
Views: 1827

Re: year and countryname extract

any suggestions on this i am little bit away from the target as able to move some of the files. here is the new file format first row should be archived

abc N Refund Maker_Japan_2017_302413 modified date :26/06 10:20
abc N Refund Maker_Japan_2017_Extra modified date:26/06 10:30
by sshree43
Mon Jul 09, 2018 10:32 pm
Forum: Windows PowerShell
Topic: year and countryname extract
Replies: 22
Views: 1827

Re: year and countryname extract

when i run this file...only half of the files are moving $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-Obje...