Wednesday, 9 September 2015

Powershell Find and Copy Files - Get-Childitem | Copy-Item

I have been playing around with PowerShell for some time now and I finally seem to be getting to grips with writing short but useful scripts. Apparently all I seem to do at work is prattle on about how "you could use PowerShell for that....." and so I thought perhaps I would share on the off-chance someone would be interested.

My son is taking Computer Science for his options and has been told that he is going to be learning PHP (which is kinda cool) and me being me, I happen to have some books on that topic ;-)

I am no Jeffrey Snover, Don Jones or Scripting Guy so don't expect anything fancy, there are plenty of people who know more than me, however, sharing is caring and all that jazz so here goes.

Whilst I have plenty of Electronic Books, I do however have one minor problem. All of the Electronic Books I have acquired over the last couple of decades are sitting on my NAS in a folder that contains 31.37GB of various PDF's/CHM's & other E-books. Being rather lazy and having no time to file them like a librarian, they are all either scattered about in the root of the drive or sitting in a few sub-folders. 

Needless to say, the built-in search facility in Windows using just *php*.* as the filter was a little bit crap and was taking an age. i had left it scanning for at least 1 hour while I got on with building DNS Server and only 30 or so books had been found out of an apparent 115. I became bored of watching windows fail to compile a "quick list" so I turned to my trusty friend PowerShell and wrote a script.

As I wanted a list of files that contained PHP in the title I used Get-Childitem with a filter for *php*.*

Get-ChildItem -Path '\\NASDrive\E-books' -File *php*.*

In order to provide the Full Path to Copy-Item as required, the following command:-

Select -ExpandProperty FullName

Provides the required result

\\NASDrive\E-books\Teach Yourself PHP, MySQL, And Apache In 24 Hours (2002).chm

This is then piped to the Copy-Item cmdlet with the required destination path. Here is the short but complete script.

Get-ChildItem -Path '\\NASDrive\E-books' -File *php*.* |
Select -ExpandProperty FullName |
Copy-Item -Destination "C:\UserPath\PHPBooks"

This way only took a minute or so and as expected the books appeared in all their glory. 115 Files/641MB all copied to my desktop in a very short time indeed.

Well, time to hang up the PowerShell apron and on to the next job.

Wednesday, 2 September 2015

Deadlines of Dismay

Now most people have a tendency to crumble under tight deadlines and seem to come apart at the seams.

Fortunately I am happier working in a high pressure environment than I am when its business as usual. My job has a disadvantage that BAU is manic enough that high pressure is the norm. I guess I should be happier 😂

Anyway I figured I would post something in order to provide myself with an outlet/distraction.

Three weeks to go before PCI Compliance is due and I have a mountain to move in order to get a pass delivered.

Needless to say I am very nervous and strangely happy to have something to get my teeth into.

Time to develop a plan/implementation strategy.

Lets see where this goes, perhaps it might get interesting.



Thursday, 8 July 2010

Time for a Joke

As I work in the IT industry, I am sympathetic with both people in this joke but can't help but find it funny. We all have acronyms for the users, we just normally don't tell them what they are :-)

Monday, 5 October 2009

UK 3-Strikes MP Ignorant on File-Sharing

UK 3-Strikes MP Ignorant on File-Sharing: "

Sion Simon, a Labour MP from Birmingham and the Parliamentary Under-Secretary of State for Creative Industries at the Department for Culture, Media and Sport, spoke out earlier this week at the National Labour Party Conference in Brighton on the proposed UK 3-strikes laws.

“The lesson of iTunes and Spotify is that what people want is ease of use and convenience and cheapness. And you only have to look at the decrease there has been in filesharing since the increase in popularity of Spotify.

“You only have to look at the number of people who came off illegal filesharing when iTunes came out to know that filesharing isn’t the answer, it’s not the future, it’s not valuable of itself – it’s a technology that currently is being used to circumvent the law.”

However, his words, as reported by the Birmingham Post, lack a certain ring of truth. For example, let’s take the claim that file-sharing decreased after Spotify gained popularity. While we agree that the service has the potential to convert many music pirates, its effect on the overall volume of file-sharing is simply not there.

The Pirate Bay informed TorrentFreak that traffic from the UK is still growing, at an average of around 1% per month. Mininova likewise has seen a 15% growth, of 7 million unique visitors a month, from 38.6 million in September 2008, to 45.6 million in August of 2009. Clearly Spotify hasn’t decreased much. Strike 1.

More worrying though is the claim that file-sharing technology is not valuable. For one, Spotify itself is based on file-sharing technology, with the brain behind the popular BitTorrent client uTorrent as one of its main developers. That aside, the state-funded BBC is involved in various BitTorrent-based projects, and the technology chiefs there believe that P2P TV has a future, and many independent artists are already putting it to use.

Over the past few years, we’ve brought you dozens of stories about people being enabled by the technology, from independent artists, to filmmakers (large and small) and even large corporations that can now effectively distribute data without incredible bandwidth outlay. File-sharing technology is very valuable to those people, Strike 2 for the MP from Birmingham.

That brings us to another statement Simon made, with Yahoo reporting him as saying that whilst it is illegal, there is currently no anti-piracy legislation. Those that have read our stories about Davenport Lyons, and ACS (and the thousands they have targeted) know there is indeed legislation. So too does Alan Ellis, and the Oink uploaders who were sentenced earlier this year. For Mr Simon, that’s strike 3.

It’s just lucky for him that no-one’s proposed a law where if an MP has gone on the record and made 3 basic factual errors, his parliamentary benefits should be cut off or throttled.

Mr Simon was contacted for comment, but did not reply at time of press

Article from: TorrentFreak, check out our new blog at FreakBits.


Comic for October 4, 2009

Friday, 19 June 2009

Cooking Exploits

Having started this Blog, I have begun to realise that there is a Dark Art to having constantly up-to-date content. It’s not so much not having anything to blog about, it is merely finding something that is interesting enough or indeed amusing enough to type about. However, I thought I would pop in the odd recipe every now and again, especially when I think it may be something you might like to try.

I will keep it simple and perhaps you will enjoy it as much as my family did :-)

Firstly a bit of background. This recipe is something that my Dad first gave to me and is the first meal I ever cooked for my other half (if memory serves me correctly, it didn't go too well as I was a bundle of nerves). I have since improved upon the recipe and have provided simple instructions so that anyone can give it a go (links go to the Tesco website – no affiliation).

Having been asked recently to provide a friend with the recipe, the following is ideal for 2 people, simply adjust ingredients dependent on however many lucky test subjects you happen to have.

Chicken & Bacon with Mash Potato

Ingreedy Grunts

Approx 5 Potatoes (but obviously enough for mash for two ;-)
Basil (dried about 1 tspn full)
Sage (dried about 1 tspn full)
Olive Oil
1 Onion halved and finely chopped
Fresh Garlic (about 3 cloves finely chopped or a heaped teaspoon of “Easy Garlic”)
Cherry Tomatoes (slack handful, chopped in quarters)
Mushrooms (optional, chestnut mushrooms are my preferred choice but that’s up to you…shitake might be better)
Streaky Bacon (4-6 slices, chopped into small strips)
Approx 250g of Chicken Breast (two chicken breasts should be enough, chopped into chunks. You could be completely lazy and buy it pre-chopped…it’s cheating but makes life easier)
1 75cl bottle of White Wine (Hock is good as it is relatively cheap and has a rather nice flavour should you fancy a glass while you are cooking)
Chicken Oxo
Sambal Oelek (optional - definitely improves the recipe and adds a subtle spicy kick. Due to the cream, it’s not at all overpowering but as such, not to everyone’s taste)
Single Cream

Cooking Destructions!

As with all recipe’s it is a good idea to prep the food first and get all of the tedious chopping etc out of the way before you start. Cooking should then only take about 15-20 mins.

Peal and dice the potatoes, rinse thoroughly with cold water and then plonk in a pan of boiling water. I usually cheat and boil the kettle, otherwise you spend what feels like a week, waiting for the water to boil. Taters, can be left to boil happily while you cook the chicken (see below).

Finely chop the garlic and the onion, place in a pan with the mushrooms and tomatoes (a Wok would be good) a couple of lugs of Olive Oil and a knob of butter and put on a low heat. Cook for approx 5 mins then add the herbs (Sage and Basil), the chopped bacon and the chicken, then turn up the heat a little and stir for another 5 mins. Once the chicken is almost sealed, add about half of the bottle of White Wine, one Chicken Oxo and 1 or 2 teaspoons of Sambal Oelek. Bring to the boil and then simmer for about 5-10 mins or until you are satisfied the chicken is cooked. Once it is cooked, turn off the gas (or lecky) and leave while you deal with the taters, which by now should be cooked enough to mash.

Drain the taters and put back in the pan. Mash the hell out of them, then add about a third of your pot of single cream. Mash the hell out of them a second time to mix in the cream. Pour the rest of the cream into your chicken/bacon and you are now ready to serve.

Remember, if you are trying to impress a young lady, then presentation at this point is always a good idea. If you haven’t drunk the rest of the white wine, this could be served with the meal.

Should anyone attempt this, then a picture would be good to add to the blog, otherwise, eat and enjoy!

Monday, 19 January 2009

Leigh Services Launched

In a bizarre turn of events, I have finally gotten round to setting up a website to provide Home Users and Small Businesses with IT support.

Seemed like a good idea and I have tried to be a little cunning and configured a Self Service Portal for users to log their own calls. Emails can also be submitted that will be logged as support calls.

Web Address is
Self Service Email Address

If your feeling helpful, please take a gander and offer any criticisms (preferably helpful rather than just sarcastic).

Onwards and upwards....perhaps a more prosperous year???

Sunday, 18 January 2009

Small Children & Shopping Trips

Sometimes, I wonder why we do it.....I don't mean why do we have kids but more, why do we take them with us when we go shopping. They have this hideous habit of "getting bored" at a drop of the hat and then begin trying to "have fun"......a concept that they do not fully comprehend. For some reason, a child's  idea of fun (or at least my son's) seems to involve "irritating his parents". In itself, it sounds like an excellent game, which he begins by picking up any item that he "really wants" or is his "favourite" and moaning about it until we start to shout at him.

I love my son very much but being embarrassed by him in Asda's (or indeed any other shop) really doesn't do it for me. After being shouted at, he begins the sulk routine.....something we have all done and as parents, get plenty of time to experience.

As you can see from the picture, he really has the hang of it ;-)

We are slowly beginning to train him out of it as much as he is training us to ignore it.

We can only hope it is just a phase and he will indeed grow out of it as I have.........fortunately for my parents, I no longer use this tactic.

Thursday, 1 January 2009

2008 New Year Message

2008 has been a different kind of year. A time for new jobs, new friends, old jobs and old friends. Not sure about anyone else but it has been a bit of a Helter Skelter.

With the onset of our coming recession, it will hopefully not be as dark and dismal as they make out on the news and more a year that myself, my family and all my friends will enjoy and if we are lucky, be more prosperous.

All that in mind, I hope you all enjoyed your Christmas break and go on to have a very Happy New Year.

Look forward to seeing you all very soon.

Take care x


Wednesday, 27 February 2008

Good point, Well presented!

MS Fined $1.4 -

This is all well and good. But what about Apple®?

To load music to your iPod®, you must install iTunes®.

iStore® are one of the few legal sites to purchase MP3/MP4's from, for your iTunes® library, or to upload to your iPod®. Once downloaded, your limited by licences which appear to only allow you to play the track on iTunes® or your iPod®.

Furthermore, if you wish to buy accessorise for your iPod®, you have to buy Apple® approved devices as non Apple® approved devices are soon to no longer work. Of course you can buy direct from Apple® iStores® online, or places such as Bluewater®, and Oxford Street.

Perhaps 'i' should also add, some 3rd party applications had developed a way to access the iTunes® database so you could play your downloaded songs from the Apple® iStore®, or from your iPod® in a 3rd party player/device. Apple® have sinced disabled this in a recent update of iTunes®, therefore eliminating the 'competition' or 3rd party developers access to the iTunes® database.

So tell me, if Microsoft® are such baddies and being fined all this $$$, why aren't Apple®?!

Phew - that took some effort! ®®®
(Written/Ranted by Lewis Hardwick)

Wednesday, 21 November 2007

1st Post - Morning Amusement

Seems C2C now has a free Wifi service (trial of course) and I thought I would take advantage and use it to distract myself from the inane ramblings and all the coughs and sneezes currently bouncing round my rail carriage.

Rather amusingly a young lady boarded the train this morning on her way to Laindon for her first day at work. Unfortunately for her, this train doesn't stop until its arrival at Fenchurch Street. Apparently the sign at the train station wasn't obvious enough when it indicated it's final destination including where it would be stopping also the way. When she remarked "I did wonder why the 2nd train listed all the stations but this one didn't!" it was all I could do to keep a straight face and ask if she would like to borrow my phone to call and advise of her late arrival.

Brightened my day :-)