RE: Speeding up a Powershell script

2016-10-24 Thread Dave Crozier
+1 And Free - a double bonus! -Original Message- From: ProFox [mailto:profox-boun...@leafe.com] On Behalf Of Richard Kaye Sent: 21 October 2016 22:06 To: profox@leafe.com Subject: RE: Speeding up a Powershell script +1 to RegexBuddy. -- rk -Original Message- From: ProfoxTech

RE: Speeding up a Powershell script

2016-10-21 Thread Richard Kaye
+1 to RegexBuddy. -- rk -Original Message- From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of Darren Sent: Friday, October 21, 2016 4:43 PM To: profoxt...@leafe.com Subject: RE: Speeding up a Powershell script My view ... RegExp syntax is fairly limited in scope

RE: Speeding up a Powershell script

2016-10-21 Thread Darren
it highly !! -Original Message- From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of Edward Leafe Sent: Saturday, 22 October 2016 7:36 AM To: profoxt...@leafe.com Subject: Re: Speeding up a Powershell script On Oct 21, 2016, at 1:53 PM, Gene Wirchenko <ge...@telus.

Re: Speeding up a Powershell script

2016-10-21 Thread Edward Leafe
On Oct 21, 2016, at 1:53 PM, Gene Wirchenko wrote: > >> +1. It's like the UberNerds who want to obfuscate just for the "fun" of it >> to be UberNerds. I felt similar about RegExp. > > Regexes can be great, but I resist the temptation to make long regexes. > That gets

Re: Speeding up a Powershell script

2016-10-21 Thread Gene Wirchenko
At 05:01 2016-10-21, mbsoftwaresoluti...@mbsoftwaresolutions.com wrote: On 2016-10-19 09:43, Malcolm Greene wrote: A great use case for getting your feet wet with Python. BTW: Powershell syntax wants me to gouge my eyes out. Anyone else feel the same way? I guess I just do not have your

Re: Speeding up a Powershell script

2016-10-21 Thread Stephen Russell
Powershell is "obectized" batch files. Your nerd status is reduced when you diss objects like that. https://gallery.technet.microsoft.com/scriptcenter/Remove-Windows-Store-Apps-a00ef4a4 because powershell is very cool. I have 25-30 scripts that I run monthly for a variety of odd reasons.

Re: Speeding up a Powershell script

2016-10-21 Thread mbsoftwaresolutions
On 2016-10-19 09:43, Malcolm Greene wrote: A great use case for getting your feet wet with Python. BTW: Powershell syntax wants me to gouge my eyes out. Anyone else feel the same way? Malcolm +1. It's like the UberNerds who want to obfuscate just for the "fun" of it to be UberNerds. I

Re: Speeding up a Powershell script

2016-10-21 Thread Man-wai Chang
On Thu, Oct 20, 2016 at 10:50 PM, Dave Crozier wrote: > I hope you didn't take the comment as disrespectful as It wasn't meant to be > in any way at all ;-) Of course not. It's easier to do it in Visual Foxpro! > I must admit that Powershell is a little like Regular

Re: Speeding up a Powershell script

2016-10-20 Thread mbsoftwaresolutions
On 2016-10-19 10:31, Peter Cushing wrote: On 19/10/2016 14:51, Dave Crozier wrote: Or: for i in $(find . -type f | perl -ne 'print $1 if m/\.([^.\/]+)$/' | sort -u); do echo "$i"": ""$(du -hac **/*."$i" | tail -n1 | awk '{print $1;}')"; done | sort -h -k 2 -r Assuming you have extglob

Re: Speeding up a Powershell script

2016-10-20 Thread Ted Roche
Well, I suppose if I wanted a console program, I could have used FP-DOS, though SYS(2000) and FSIZE() instead of ADIR(). But I have a SQL-queryable cursor and can use the report writer or textmerge to produce output in the format desired. On Thu, Oct 20, 2016 at 9:35 AM, Man-wai Chang

Re: Speeding up a Powershell script

2016-10-20 Thread Stephen Russell
It is .NET for the command line. You ask specific commandlets to get data for you and then iterate through it. In this case you are making a new container object to hold the "new look" as I vaguely remember. Currently in my own SharePoint hell of an upgrade that duped all list contents in 2013

RE: Speeding up a Powershell script

2016-10-20 Thread Dave Crozier
then the learning or re-learning curve is huge! Hope you found a solution anyway. Dave -Original Message- From: ProFox [mailto:profox-boun...@leafe.com] On Behalf Of Man-wai Chang Sent: 20 October 2016 14:35 To: ProFox Email List <profox@leafe.com> Subject: Re: Speeding up a Powershell script I ac

Re: Speeding up a Powershell script

2016-10-20 Thread Man-wai Chang
I actually wrote and compiled a console C program to do it using VS 2013 Pro. :) https://sites.google.com/site/changmw/scripting/dire/dire-20161020.zip?attredirects=0=1 On Thu, Oct 20, 2016 at 4:13 AM, Ted Roche wrote: > 30 lines in VFP. As a bonus, you end up with a cursor

Re: Speeding up a Powershell script

2016-10-20 Thread Man-wai Chang
Powershell does not have awk and find. Are you using portable Ubuntu in Windows 10? On Wed, Oct 19, 2016 at 9:49 PM, Dave Crozier wrote: > Linux: > > find . -type f -printf "%f %s\n" | > awk '{ > PARTSCOUNT=split( $1, FILEPARTS, "." ); > EXTENSION=PARTSCOUNT

Re: Speeding up a Powershell script

2016-10-20 Thread Man-wai Chang
For the record: I speak Cantonese and it is quite different from both Mandarin (Taiwan) and Putonghua (Beijing)! And the PLA army speaks Putonghua. :) On Wed, Oct 19, 2016 at 9:45 PM, Dave Crozier wrote: > For a moment I thought the script was written in Mandarin! >

Re: Speeding up a Powershell script

2016-10-20 Thread Man-wai Chang
It's native query language is definitely not 100% basic ANSI SQL ... On Wed, Oct 19, 2016 at 9:43 PM, Malcolm Greene wrote: > A great use case for getting your feet wet with Python. > > BTW: Powershell syntax wants me to gouge my eyes out. Anyone else feel > the same way? --

Re: Speeding up a Powershell script

2016-10-19 Thread Ted Roche
30 lines in VFP. As a bonus, you end up with a cursor of data, and an on-topic thread! CREATE CURSOR curFiles (filesPK int NOT NULL autoinc, extension c(12), totalsize I) INDEX on extension TAG extension lnResult = recurse() WAIT WINDOW NOWAIT "Completed counting " + TRANSFORM(lnResult) + "

Re: Speeding up a Powershell script

2016-10-19 Thread Peter Cushing
On 19/10/2016 14:51, Dave Crozier wrote: Or: for i in $(find . -type f | perl -ne 'print $1 if m/\.([^.\/]+)$/' | sort -u); do echo "$i"": ""$(du -hac **/*."$i" | tail -n1 | awk '{print $1;}')"; done | sort -h -k 2 -r Assuming you have extglob enabled: shopt -s extglob Feck me Dave, what

RE: Speeding up a Powershell script

2016-10-19 Thread Dave Crozier
ge- From: ProFox [mailto:profox-boun...@leafe.com] On Behalf Of Dave Crozier Sent: 19 October 2016 14:50 To: ProFox Email List <profox@leafe.com> Subject: RE: Speeding up a Powershell script Linux: find . -type f -printf "%f %s\n" | awk '{ PARTSCOUNT=split( $1, F

RE: Speeding up a Powershell script

2016-10-19 Thread Dave Crozier
LETYPE_MAP[FILETYPE], FILETYPE; } }' | sort -n Dave -Original Message- From: ProFox [mailto:profox-boun...@leafe.com] On Behalf Of Man-wai Chang Sent: 18 October 2016 06:45 To: ProFox Email List <profox@leafe.com> Subject: Speeding up a Powershell script The follo

RE: Speeding up a Powershell script

2016-10-19 Thread Dave Crozier
] On Behalf Of Malcolm Greene Sent: 19 October 2016 14:43 To: profox@leafe.com Subject: Re: Speeding up a Powershell script A great use case for getting your feet wet with Python. BTW: Powershell syntax wants me to gouge my eyes out. Anyone else feel the same way? Malcolm [excessive quoting removed

Re: Speeding up a Powershell script

2016-10-19 Thread Alan Bourke
> BTW: Powershell syntax wants me to gouge my eyes out. Anyone else feel > the same way? Yeah, I've never liked it. Super powerful but far too wordy. -- Alan Bourke alanpbourke (at) fastmail (dot) fm ___ Post Messages to: ProFox@leafe.com

Re: Speeding up a Powershell script

2016-10-19 Thread Malcolm Greene
A great use case for getting your feet wet with Python. BTW: Powershell syntax wants me to gouge my eyes out. Anyone else feel the same way? Malcolm ___ Post Messages to: ProFox@leafe.com Subscription Maintenance:

Re: Speeding up a Powershell script

2016-10-19 Thread Man-wai Chang
Last resort! :) On Tue, Oct 18, 2016 at 6:28 PM, Dave Crozier wrote: > Do it in native VFP ... -- .~. Might, Courage, Vision. SINCERITY! / v \ 64-bit Ubuntu 9.10 (Linux kernel 2.6.39.3) /( _ )\ http://sites.google.com/site/changmw ^ ^ May the Force and farces be with

Re: Speeding up a Powershell script

2016-10-18 Thread Ted Roche
On Tue, Oct 18, 2016 at 6:28 AM, Dave Crozier wrote: > Do it in native VFP ... > > Dave > +1! ___ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox OT-free version of this

RE: Speeding up a Powershell script

2016-10-18 Thread Dave Crozier
Do it in native VFP ... Dave -Original Message- From: ProFox [mailto:profox-boun...@leafe.com] On Behalf Of Man-wai Chang Sent: 18 October 2016 06:45 To: ProFox Email List <profox@leafe.com> Subject: Speeding up a Powershell script The following Powershell script aims to

Speeding up a Powershell script

2016-10-17 Thread Man-wai Chang
The following Powershell script aims to count and calculate file sizes of each unique file extension in the current folder recursively. How would you speed up this script for a folder with over 17 entries? The problem is the following two statements being repeated for each unique file