Wednesday, July 8, 2009

Introduction and the Ultimate Delete Command

Hello, world! :) This is sort of a technology/programming blog that I've started partly for my own amusement, partly to catalogue and share information and partly just because I want one.
I am a professional developer with lots of scripting and administration experience. My language of choice is C# but I can program in Java, VB.net, VB6, VBA, VBScript, PowerShell, Perl, JavaScript and of course batch. I have written my fair share of SQL sprocs. I also have experience with web server/related technologies (IIS, Apache, asp, asp.net, CGI/Perl...). This is hardly a resume, but if you want mine feel free to ask for it.

I'm still laid-off for now, looking for a new job. I have two prospects - one is a developer position and the other sounds a lot more like scripting with some development. Since one of the requirements for the latter is Perl and in an environment I've worked in before, I thought I'd go look through some of the scripts I've written in the past.

I came across a batch "one-liner" I titled, "The Ultimate Delete Command". I came up with this because when trying to free up space on "special" servers, Windows Explorer would stop on files in use or ask you to confirm over and over, etc. etc. This command removes read-only, hidden and system attributes and deletes files and folders starting from the current directory in CMD. I wrote this before PowerShell was popular among the Windows crowd. :)
Use with caution.

FOR /f "tokens=1 delims=:" %f in ('ECHO %CD%') do for /f "tokens=2 delims=:" %g in ('attrib /s') do ( attrib -s -h -r "%f:%g"&del "%f:%g"&rd /s "%f:%g" /q )

No comments:

Post a Comment