Delete files older than x days from Windows Command Line

I recently had to work out why a server at a client site was experiencing problems. It didn’t take long for me to find that the hard drive containing the Windows TEMP files was full.

When emptying a TEMP folder, it can be tempting to delete everything, but that can cause it’s own problems. I prefer to sort the files by date and then delete those that are more than a few days old. Once I’ve done this, to prevent the problem from reoccuring (regardless of how ill-disciplined the other users of the PC or server are), I leave a scheduled task running to keep the folder clean(ish).

This is the command that I run in my scheduled task:

forfiles >/s /m *.* /d -7 /c “cmd /c del @path

This deletes any files, folders or sub-folders that are more than 7 days old from the folder where it runs. Whatever you do, don’t run it in your C:\ drive! This can be slow because it runs recursively through all files in all the sub folders of theplace where it runs. This is why I like to leave it running as a scheduled task to keep my test kit in good shape.

Why is Unite in favour or staying in the EU?


Last weekend, I had an interesting exchange on FaceBook. As well as a few “likes” or “thumbs up”, I had a reply from a friend who is generally left-leaning. She included an image of a Union leaflet  explaining the Unite Union’s reasons for wanting to stay in the EU.

2016-05-22 11_01_47-Start

The Unite Union is claiming that the EU is responsible for 10 benefits that British citizens have in the workplace, these include Health and Safety legislation, equal pay law, protection against discrimination, parental leave, sick pay and more.

I’m really surprised that Unite has this opinion. Much of the legislation that they’re referring to is actually British legislation enacted by Labour governments. I can’t see why the trade unions don’t want to take at least some credit for this. For example the Health and Safety legislation and much of the early equality legislation (sexual, race discrimination / equal pay etc.) came from Harold Wilson’s Labour government of the early 1970s, much of it pre-dated our membership of the EU.

The more recent legislation (European Social Chapter) came primarily from Tony Blair’s government in 1997 and under the Cameron/Clegg coalition in 2010.

You can’t deny that all of this legislation is fundamentally a good thing for British workers and any future UK government would be unlikely to repeal it unilaterally. Despite the fact that this legislation is a good thing, the EU can’t claim responsibility for all of it.

Addressing some of the points that Unite makes:

Workplace safety – The 1977 or 1996 Safety Representatives and Safety Committees Regulations Acts, are protected in British, not EU law.

The European Social Chapter – When the Social Chapter was enshrined in EU law (by the 1991 Maastricht treaty) the UK opted out. Personally, I think that this was a mistake, but it’s wrong for Unite to claim that the EU is responsible for putting these employment rights into British law. Tony Blair’s government did that in 1997. Nobody on the “Brexit” side is suggesting that we should repeal these laws.

Equality – The 2010 Equality Act is enacted in British, Not EU law and although it incorporates some EU rules into British law, many of the laws brought about as part of this act are updates Harold Wilson’s laws from the early 1970s, many of these original laws were brought in before we even joined the EU.

EU working time directive – Tony Blair opted out of the EU working time directive allowing workers to work more than 48 hours per week (if they volunteered for extra work). This still allows workers to be coerced into working longer hours so realistically most British workers don’t enjoy the full protection of the EU social chapter.

Equal Pay – The Equal Pay Act of 1970 was the first attempt to provide pay equality based on gender (this came in before we joined the EU). Despite this law and subsequent EU rulings on this subject there is still a significant disparity between the money that women earn compared to men. This chart shows the significant gender pay gap that still exists in Europe. For this reason, it is wrong to claim that the EU guarantees equal pay. http://ec.europa.eu/eurostat/documents/7116161/7188977/1305EN.pdf

Holiday Health Cover – the “Healthcare on holiday” protection comes from the EHIC card. This is due to the UK’s membership of the EEA (European Economic Area) and has nothing to do with the EU. Both Switzerland and Iceland are members of the EHIC scheme even though they aren’t EU members.

I find it hard to believe that Unite is campaigning to remain a member of the EU. With the TTIP legislation on the horizon which will erode workers rights and according to CEPR projections increase EU unemployment by 1.3 million, I would have thought that this is just the thing that Unions should oppose.

Tony Benn sums up the EU for me. Fundamentally undemocratic and heading in the wrong direction. It isn’t the good things that the EU may or may not have done in the past, it’s the bad things that they are planning to do in the future that worry me. That’s why I want out.

(Skip to 34 seconds to hear Tony Benn)

 

********************** Update **************************

Since I wrote this blog, Dan Hannan (MEP and prominent Eurosceptic) tweeted this. It shows the supposedly independent groups including the OECS, IMF, IFS, LSE who’ve all benefited from EU funding.

It seems that the Unite Union is also on the list and received €285,000 funding from the EU. It appears that, “EU who pays the piper calls the tune.”

2016-05-25 13_32_05-Daniel Hannan (@DanHannanMEP) _ Twitter

What can a long-dead Prussian teach us about IT?

I originally wrote this for the Trust IV blog, but I thought it deserved a “republish” here…

As a performance tester, along with many people in the IT-world, I’m often asked to plan for different eventualities. I have to write test plans, software deployment plans or help to provide estimates for how long a piece of work will take.  For predictable, simple work, this is fairly easy and is the sort of thing that people learn in school maths lessons. e.g. “If it takes one man one hour to dig a hole, how long will it take two men to dig a similar hole?”

In the IT world it often isn’t as simple as that. To (mis)quote Donald Rumsfeld, things that catch us out are the “unknown unknowns, those things that we don’t know that we don’t know.” How can we be sure that the configuration of a particular server is the same as the last one where we performed a particular task?
How do we know that the test data that we’ve been given is a true representation of live data?
How can we be sure that the business requirements we’ve been given are correct?

With a whole host of unknowns we need to be prepared to change our plans at a moment’s notice.
This is where the “dead Prussian” comes in…..

This cHelmuth_von_Moltke_(1800-1891)hap is Helmut von Moltke the Elder; a Prussian army officer who died in Berlin in 1891. He was the chief of staff of the Prussian army and an excellent strategist. Rather than directing his armies with explicit commands, which ran the risk of becoming irrelevant quickly, he recognised that it made more sense to describe an overall strategic plan to his officers and rely on them to help him to achieve his objectives.

 

He recognised that military strategy was best described as a system of “options” since only the beginning of a military operation was plannable. He tasked his officers with calculating numerous possible outcomes and “what if?” scenarios. Only by preparing for multiple possibilities, could he be ensured of success.

His ethos is best described with the quote which is most commonly attributed to him:
“No plan of operations extends with certainty beyond the first encounter with the enemy’s main strength.”

Often abbreviated to:
“No plan survives contact with the enemy.”
I think that “Moltke” would have been at home in the IT world. He rejected a single detailed plan in favour of multiple “what if” plans and empowered his subordinates, trusting them to make the right decisions, despite the fact that he couldn’t always be in contact with them. Although the “military subject matter” of his famous quotes isn’t pertinent in IT, the theme remains relevant.

As I tester, I believe that these quotes are spot on:

  • No test plan survives first contact with application code.
  • No project plan extends with certainty beyond the first milestone.
  • There is no such thing as the “perfect test”, prepare for the unexpected.
  • If something can go wrong, it probably will….. be prepared for it.

Can you think of any other “Moltke-themed” quotations that are relevant to you?

Answers on a postcard….well perhaps in a Tweet to @TrustIV or @RichardBishop