|
|
Browse by Tags
All Tags » file » PowerShell
-
And another translation of a Hey Scripting Guy Article : How Can I Delete Files That Are a Specified Number of Hours Old?
dir |? {$_.CreationTime -lt (get-date).AddHours(-8)} | del -whatif
or for files not written in the last 8 hours :
dir |? {$_.LastWriteTime -lt (get-date).AddHours(-8)} | del -whatif
And yes the ...
-
One of the things I like most about PowerShell is how you can use the interactive commandline, commandbuffer and REPL (Read - Evaluate - Print - Loop) to quickly construct a solution, especialy with the -WhatIf parameter.
See this IRC chat (www.PowerShellLive.com). [21:54] <frb-work> zz_mow_zz: generalhan wants to ...
-
The Chat did go on while I made Last blog entry PowerShell : the power of REPL, -WhatIf and ScriptBlocks as Parameter when moving files :
[22:29] <generalhan> ok now time to work on something a bit harder ! ...[22:29] <generalhan> i have to move files based on date now too !
[22:31] <generalhan> so i have a ...
-
Another translation of an example script from a Hey scripting guy column How Can I Locate a Word in a Text File and Then Echo Back That Word and Any Remaining Text? from VbScript to PowerShell .
I made these 2 different versions within minutes : Get-Content test.txt | out-string |% ...
-
Ars technica did an article about PowerShell : Microsoft PowerShell rolled into Longhorn Server
In this article two PowerShell examples from my blog are used : How to get the uptime of a specific service: $s = gwmi win32_service -filter ''name = 'spooler''' ''{0}'' -f ((get-date) - ([wmi]'').ConvertToDateTime((gwmi ...
-
from the Hey Scripting Guy article :
How Can I Parse a Tab-Delimited File and Then Save That as a Comma-Separated Values File?
gc tab.txt |% {$_.split(''`t'') |? {$_ -match '='} |% {$r = new-object object} {$r | add-Member -memberType noteProperty -name $_.split('=')[0] -Value $_.split('=')[1]}{$r}} | export-csv -NoTypeInformation ...
-
Again I will mimic a Scripting Guy article here in PowerShell, only this time from the Sesame Script series :
Sesame Script: Scripting Text Files
Preamble
As this entry also was written as a training for the International Winter Scripting Games, And just to make you feel even better about entering, this month’s Sesame ...
|
|
|