text:
I want to creat the following new Directory with the New-Item Cmdlet. The name of the directory is created by the Prefix 2 Variables and "_" => "Archive_" + $ArchivDirectory + "_" + $Date).
I get always get Archive_\LOGS\_111230 (separated by "\")
instead of a Directory Name like "Archive_LOGS_111230"
I cant resolve this issue alone.
Can someone help me out?
Get-ChildItem d:\Logs\ -include *.log -recurse | Where-Object {!$_.PsISContainer} |foreach{$ArchiveDirectory = Split-Path d:\Logs\ -NoQualifier #this gives me "\Logs\"$ArchivePath = New-Item -type container -path ("Archive_" + $ArchiveDirectory + "_" + $Date) -type directory -Force$_ | Copy-Item -Destination $ArchivePath -Force
I tried also this :
$ArchiveDirectory = Split-Path d:\LOGS\ -NoQualifier $targetpath = "\\omsrv01\users\jf\Backup\"cd $targetpathmkdir ("Archive_" + $ArchiveDirectory + "_" + $Date)
But get this:
Verzeichnis: \\omsrv01\users\jf\Backup\Archive_\LOGSMode LastWriteTime Length Name ---- ------------- ------ ---- d---- 30.12.2011 11:44 _20111230_0851
What did i forget to do in order to get the directory named
" Archive_LOGS_20111230_0851"
I could resolve it by my own:
#PARAMETER$days = (Get-Date) - (New-TimeSpan -Days 40)$source = "D:\Logs\"$formats = "*.txt", "*.csv"$target = "D:\BACKUP\"$ArchiveDirectory = Split-Path $source -NoQualifier $targetpath = "\\omsrv01\users\jf\Backup\"$ArchivePrefix = "Archiv_"$date = Get-Date -format yyyyMMdd_HHmm$ArchiveDirectoryName = $ArchivePrefix + $ArchiveDirectoy + $date
unfortunately it gave my only back
instead of Archive_LOGS_111230_1309
What is wrong?
I have made a typing error but even if write it right it gives me something like a path and not a DirectoryName
You had a typo in the last line. This works fine for me:
$days = (Get-Date) - (New-TimeSpan -Days 40)
$source = "D:\Logs\"
$formats = "*.txt", "*.csv"
$target = "D:\BACKUP\"
$ArchiveDirectory = Split-Path $source -NoQualifier
$targetpath = "\\omsrv01\users\jf\Backup\"
$ArchivePrefix = "Archiv_"
$date = Get-Date -format yyyyMMdd_HHmm
$ArchiveDirectoryName = $ArchivePrefix + $ArchiveDirectory + $date
Write $ArchiveDirectoryName
The result is Archive_\Logs\20111230_0734. That's because $ArchiveDirectory contains "\Logs\" - you might consider outputting the contents of your variables as you change them, so that you can see what's actually in them. I think you were assuming $ArchiveDirectory would contain 'Logs' which isn't the case.
If you don't want the \ in there, you could use the -replace operator to replace "\" with "" and remove the backslashes.
But i figured out when i use -Leaf instead of -NoQualifier
like so
$ArchiveDirectory = Split-Path $source -Leaf
As a result i get also "Logs" without the slash "\".
Thanks for the tip to use write command to validate variable contents
I have one more question
Is it possible to pass the argument (in this case a UNC path) without using " " from the command line?
Or are you forced to enclose a UNC path in double quotes ""?
$targetpath = \\srv01\backup\
$age = 30
powershell.exe -noexit c:\temp\script.ps1 -argument1 \\srv01\backup\, -argument2 30
You only need the quotes if the value contains a space, tab, or other whitespace, or comma. In your example, I'm not sure why the comma is there. To PowerShell, that would be illegal - it indicates a list of values, and you haven't provided a second value.
Also, your usage isn't exactly correct. PowerShell.exe doesn't have an "-argument1" or "-argument2" parameter. I understand that those are parameters you intend to pass to your script, but that isn't quite the correct syntax when you're calling Powershell.exe.
powershell.exe -noexit -command "c:\script -arg1 val -arg2 val2"
Is probably more what you're looking for. There are other ways to accomplish this, though.
Nice tip but unfortunately i don't get the rigth result for some reason i don't know:
Here my last try:
$source = D:\Logs\BSC\
$ArchiveDirectory1 = $source $ArchiveDirectory2 = $ArchiveDirectory1 | split-path ($_.fullname -Replace "\", "") -NoQualifierWrite $ArchiveDirectory1 Write $ArchiveDirectory2
Result for $ArchiveDirectory2 is : $_.fullname -Replace "\", ""instead of
Where is the error??
this question reffers to your comment of 12-30-2011 9:30 AM
What's the goal, here? I don't think you've ever actually mentioned. What input are you starting with, and what's the desired output?
The goal here is to create a backup/archive of old Logfiles of an application (maintaining the original structure and name of the sourcedirectory.
The User specifies a sourcepath ($ReferenceDirectory), the targetpath ($targetPath), the formats for example only *.txt or *.log Files($formats) and the age of the files to be archived ($RetentionDays) by passing the arguments from the command line or batchfile:
The Archivedirectory should have the same structure/name as the sourcedirectory but whitout backslashes.
for Example
$ReferenceDirectory = d:\Logs\BSC\
$Archivedirectory should be = Logs_BSC
and $ArchiveDirectoryName = Archive_Logs_BSC_20120104 (consists of a prefix, variable Archvivedirectory and the date
#powershell.exe -noexit file .\scriptname Argument1 Argument2#Param(#[string]$ReferenceDirectory, (Mandatory)#[string]$targetPath, (Mandatory)#[string]$formats, (Mandatory)#[int]$RetentionDays, (Mandatory)#[switch]$Recurse (Mandatory 3 Levels of Recursivity) #)#Script continuation$ErrorActionPreference = "SilentlyContinue"#Module ZIP CreationImport-Module pscx#Set TimeSet-Date -Date (Get-Date)#PARAMETER + VARIABLEN$RetentionDays = 30 #alternativ => $age = (Get-Date) - (New-TimeSpan -Days 30)$ReferenceDirectory = "D:\Logs\BSC\"$targetPath = "\\opm-w26\BACKUP\"$formats = "*.txt", "*.csv"$ArchiveDirectory = Split-Path $ReferenceDirectory -Leaf #Wird für ArchiveDirectoryName benötigt $ArchivePrefix = "Archive_"$date = Get-Date -format yyyyMMdd_HHmm# Get all the files from the ReferenceDirectory$FilestoArchive = Get-ChildItem $ReferenceDirectory -Include $formats -Recurse -errorAction Silentlycontinue | Where-Object { $_.LastWriteTime -lt (Get-Date).AddDays(-$RetentionDays) } #Parse path=> $ArchiveDirectoryName$ArchiveDirectory = Split-Path $ReferenceDirectory -Leaf #needed to Build ArchiveDirectoryName $ArchiveDirectoryName = $ArchivePrefix + $ArchiveDirectory + "_" + $date#ArchiveDirectory to be copied$completeArchivePath = $targetpath + $ArchiveDirectoryName #Zip (Function Archive with compressing)$Level=1Import-Module pscxWrite-Zip -Path $filestoArchive -outputpath ("$completeArchivePath" + ".zip") -level $Level -Quiet#Log of archived Files$backup_log = Dir -Recurse $filestoArchive | out-File -Filepath "$targetpath\backup_log.txt" -Encoding utf8 -Force#Purge archived Files$FilestoArchive | Remove-Item -Force -recurse -ErrorAction SilentlyContinueI also have to create 3 different functions from which the user can chooose.
Function DeleteLogs
Function ArchiveLogs
Function ArchiveLogsand Compress
I hope now the goal is clear.
I appreciate your help
I have now built my function (called Archiver) but i dont get it how to pass params / Arguments from the batchfile to the function
#PARAMETER$RetentionDays = 30 $ReferenceDirectory = "D:\Logs\"$targetPath = "D:\BACKUP\"$formats = "*.txt", "*.csv"$variableFunction = 2#FIX Variables$ArchiveDirectory = Split-Path $ReferenceDirectory -Leaf #need for building the archivedirectoriesname$ArchivePrefix = "Archive_"$date = Get-Date -format yyyyMMdd_HHmm$Level=1 #Compression Level#Fetch Files and Buid ArchiveDirectory# Get all the files from the ReferenceDirectory$FilestoArchive = Get-ChildItem $ReferenceDirectory -Include $formats -Recurse -errorAction Silentlycontinue | Where-Object { $_.LastWriteTime -lt (Get-Date).AddDays(-$RetentionDays) } #parse path => $ArchiveDirectoryName$ArchiveDirectory = Split-Path $ReferenceDirectory -Leaf #needed for building the Archivedirectoryname$ArchiveDirectoryName = $ArchivePrefix + $ArchiveDirectory + "_" + $date#ArchiveDirectory to be copied$completeArchivePath = $targetpath + $ArchiveDirectoryName function Archiver {$RetentionDays = 30 #alternativ => $age = (Get-Date) - (New-TimeSpan -Days 30)$ReferenceDirectory = "D:\Logs\" $targetPath = "D:\BACKUP\" $formats = "*.log", "*.txt"$variableFunction = 2$Level = 9#Param(# [string]$ReferenceDirectory, # [string]$targetPath,# [string]$formats,# [int]$RetentionDays,# [switch]$variableFunction#) switch ($variableFunction) { 1 {$cutoff = (Get-Date).AddDays(-$RetentionDays) Get-ChildItem -Path $ReferenceDirectory -Include $formats -Recurse | Where-Object {-not $_.PsIsContainer -and $_.LastWriteTime -gt $cutoff } | Remove-Item -WhatIf } 2 {Import-Module pscx Write-Zip -Path $filestoArchive -outputpath ("$completeArchivePath" + ".zip") -level $Level -Quiet #Log der Archivierten Files $backup_log = Dir -Recurse $filestoArchive | out-File -Filepath "$targetpath\backup_log.txt" -Encoding utf8 -Force} 3 {$cutoff = (Get-Date).AddDays(-$RetentionDays) Get-ChildItem -Path $ReferenceDirectory -Include $formats -Recurse | Where-Object { -not $_.PsIsContainer -and $_.LastWriteTime -gt $cutoff } | Copy-Item -container -Destination $targetPath $filestoArchive | Remove-Item -WhatIf #Log der Archivierten Files $backup_log = Dir -Recurse $filestoArchive | out-File -Filepath "$targetpath\backup_log.txt" -Encoding utf8 -Force } } #end Function}
How can i pass for example 1 from the commandline to the function
powershell.exe -noexit -file .\function_Archiver.ps1 -referencedirectory d:\Logs\BSC\ -targetpath \\omsrv01\BACKUP -formats *.txt, *.log" -Retentiondays 30 -variableFunction 3
Somehow it wont work. I know that it is possible to leave out the "-parameter" keyword by using a positional parameter . But what i Dont know is how to creat a positional Param?
like this?
param ( [parameter(Position=0, Mandatory=$true, [string]$ReferenceDirectory
Sort of.
[CmdletBinding()]param( [Parameter(Mandatory=$True,Position=1)] [string]$Reference, [Parameter(Mandatory=$True,Position=2)] [string]$target)
You've got the syntax slightly wrong. You can also omit the [Parameter()] business completely. All parameters are positional by default - you don't need to declare them that way specifically.


text:
You are a fan of khan racing ? Come to discover the best forums khan racing on the internet and share your experience with a community fan of khan racing . You can also build a forum khan racing and create your online discussion.
Free forum : Group For Pigeon Fanciers
free, #racing, pigeons, show, fancy, pigeon, chat, loft, flying, club, online, shows
We paint it, You race it!
Free forum : Bostons hottest auto forum. Builds | Sales | Meets | Teams | Racing | Photos | Videos
jdmass, bostons, hottest, auto, forum, builds, sales, meets, teams, #racing, photos/videos
Porsche Hybrid 924/944/968 and 928 V8 Conversions LS1 , LT1, engine swap, paint, glass, used parts, 911, 928, wiring, headliner, fiberglass , fiberglass body parts,Porsche Boxster , Cayman, Boxster Spec Racing,
porschehybrids, 944hybrids, porsche, conversion, ls1.lsx, forum, engine, chevrolet, boxster, cayman, hybrid, v8conversion, spec, #racing
Trans Tasman Rivals - TTR Racing Australia v New Zealand Sim Racing TTR Rfactor
trans, tasman, rivals, rfactor, factor, fvrnzv8, australia, zealand, rfactor., nzv8, #racing
"A small NR2003 league with a big heart"
We are a group of RC Enthusiasts in Singapore. Join us for our weekly RC Meet ups and ad hoc RC meets!
rc4wd, crawlers, scale, trucks, axial, scx10, ax10, dingo, tamiya, hilux, highlift, clod, buster, ford, toyota, traxxas, summit, #racing, savage, flux, cr01, venom, creeper, competition, rock, crawler, road, radio, control, honcho
Online Forum entertaining fans of V8 Supercars, Greg Murphy and the teams he has belonged to. Past and Present.
club, greg, murphy, russell, ingall, kelly, #racing, supercars, fujitsu, paul, morris, forum, fans, supporters, rick, todd
Early Bird Racing Sim Racing League was founded in November 2013, with a mission of providing a realistic racing environment, one with emphasis on clean racing and respect. EBR races and practices are scheduled to allow a summer and winter break from
iracing, early, bird, #racing, league, arca, nascar, nationwide, game, (ebr), earlybirdracing, exfinity, daytona
An Nr2003 Online Racing League
forum : Radiator Springs Racing
netkar, radiator, springs, mugello, championship, #racing, online, radiators-champ, champion
Home of the Virtual LMR Team
A forum for all Wisconsin area auto enthusiasts
wisconsin, cars, #racing, auto, street, madison, milwaukee, janesville, race, track, drag
Free forum : MAORA CHAT. Free forum : MAORA CHAT. Free forum, off road racing trucks buggies vw chevy ford lucas oil,
Free forum : Digital and Analogue Slotcar Racing around Brisbane's Northside
brisbane, slotcar, north, slot, #racing, digital, analogue, around, brisbane's, northside
free forum : Motor racing club. free forum : SSAC. free forum,

subset: commoncrawl


text:
Miguel Cotto's advisor, Gaby Penagaricano, spoke to RingTV.com concerning potential matchups against WBO welterweight titleholder Manny Pacquiao, WBC counter part Floyd Mayweather Jr. and WBC junior middleweight beltholder Saul "Canel" Alvarez.
An advisor/attorney for Cotto (37-2, 30 knockouts) for his past 18 fights starting in the fall of 2004, Penagaricano, 43, said that much depends on whether or not Pacquiao is able to renew the twice-failed negotiations for a bout against Mayweather.
Penagaricano also denied a report by RingTV.com that negoations had begun for a bout featuring Cotto, of Puerto Rico, and Alvarez (39-0-1, 29 KOs), 21, of Mexico.
The owner of the WBA's junior middleweight crown, Cotto, 31, is coming off last month's 10th-round stoppage of ex-beltholder Antonio Margarito at New York's Madison Square Garden, which avenged Margarito's 11th-round knockout victory that dethroned a previously unbeaten Cotto as WBA titleholder in July of 2008.
The stoppage was the third straight for Cotto since being dethroned by Pacquiao (54-3-2, 38 KOs) as WBO welterweight beltholder via 12th-round knockout in November of 2009. Cotto dethroned Yuri Foreman by ninth-round stoppage in his junior middleweight debut in June of 2010, and vanquished ex-beltholder Ricard Mayorga via 12th-round knockout in March.
Cotto's resurrection has him being considered as a potential rival for Pacquiao, 33, either in May or June, along with Mayweather (42-0, 26 KOs), RING lightweight beltholder Juan Manuel Marquez, WBO junior welterweight titleholder Tim Bradley and IBF/WBA junior welterweight titlewinner Lamont Peterson.
The five fighters' names were presented to Pacquiao by his promoter, Top Rank CEO Bob Arum, and his advisor, Michael Koncz, who reportedly favored Cotto after their discussion.
"We have a list of fighters he can fight in the immediate future. Cotto has a lot of people's say because of how great he performed against Margarito," said Arum during an interview with Chino Trinidad of GMA News in the Philippines on Jan. 12.
"And not only that, [Cotto] demonstrated his drawing power by selling out Madison Square Garden and doing big numbers on pay per view as we analyzed pay per view numbers."


text:
Corripio is the premier tool for gathering album artwork. Corripio enables the user to get the best artwork available for their iTunes libraries with the click of a button. The user also has the ability to search for song lyrics. The lyrics will automatically be added to each songs' ID3 tag. Corripio is the iTunes companion a music lover cannot live without.
Required OS: not specified
Tags: itunes , itms , album , artwork , art , cover
23 Opinions
Awesome app
If you are using multiple iTunes libraries it will not find them automatically, it uses a hardcoded path (that you can fortunately select in the options). It should just pick up the active iTunes library automatically.
You are unable to use it to isolate only those tracks that do not have artwork.
iTunes does not write the artwork that it acquires from the ITS to the file. It stores it in a separate area. From the user's perspective, there is no difference. Yet Corripio sees these files as missing artwork. I advise against using this program until that changes.
I agree with the previous commenters that the artwork it finds is a bit rubbish. I've tried to fix this by coding up a plugin that uses Google Image Search. It's my first Ruby script though, so be gentle :-)
Save the below to a file and then read http://nclasssoftware.com/corripio_scripts/ to find out how to install it.
require 'net/http'
require 'open-uri'
require 'uri'
require 'cgi'
query = (ARGV + ["album"]).join(" ")
sizes = ["medium", "large", "xlarge"].join("|")
uri = "http://images.google.co.uk/images?hl=en&q=#{CGI.escape(query)}&imgsz=#{CGI.escape(sizes)}"
source = open(URI.parse(uri)).read.gsub("\r\n", "")
matcher = /dyn.Img\(".*?",".*?",".*?","(.*?)"/
matches = source.scan(matcher)
matches.first(10).each { |match| puts match.first }
I'd love to use it, since it offers exactly what I want.
But it's crap. Looks like it was programmed with hot needles. It crashes two out of three times whenever I run it. Even when all I try to do is fix capitalization.
Unfortunately it seems to only work from the iTunes library, you can't just drag and drop a file and save the album cover as a picture file in a folder.
This software is utter crap. So far the choises it has given me have been 95% absurd and 5% to the point. I totally recommend against it.
It will say and sort if a track has/hasn't got artwork, but it won't actually show any of it outside of searching? Bizzare.
Good that user-scripts are in this latest version, as I can't rely on the American big box catalogues for what I listen to. So I've been better off with Curator and its Google-bilities.
Does this get artwork from the iTMS yet? I know art collector does...
Magnificent! I tried several artwork downloading apps and none of them compares to this. Hands down, the best app for its purpose.
Page 1 of 3. 23 entries.


text:
Coming up in the next {{countdown}} {{countdownlbl}}
Coming up next:
Skip to this video now
Now Playing:
Play Video
This transcript has been automatically generated and may not be 100% accurate.
Jessica Simpson Pregnant: Singer's Holiday Tweet
Rachel Smith explains what has people buzzing on the "GMA" Pop News Heat Index.
Now Playing: Jessica Simpson Pregnant: Singer's Holiday Tweet
Now Playing: Instant Index: Cop Saves Drowning Woman, Missing Dog?s Homecoming
Now Playing: US Gold Medalist Katie Ledecky Throws Out 1st Pitch at Nationals Game
Now Playing: Sailors Serenade WWII Vet
Now Playing: Popular 'Super 80s' Sent to Airplane Boneyard for Retirement
Now Playing: Race to Find Survivors After Deadly Earthquake Hits Italy
Now Playing: Multiple Twisters Touch Down in Indiana
Now Playing: American University in Kabul Attacked by Gunmen
Now Playing: Trump Attacks Clinton While Appearing to Flip-Flop on Immigration
Now Playing: Hillary Clinton Team Pushes Back on Clinton Foundation Attacks
Now Playing: Wrongfully Convicted Man Freed After Retrial
Now Playing: Senate Gives Mylan 2 Weeks to Respond to EpiPen Price Hike
Now Playing: Georgia Gas Station Shootout Caught on Camera
Now Playing: Teacher Turns to Music to Welcome New Students
Now Playing: Chevy Unveils 10 New Cars Featuring "Teen Driver Report Card"
Now Playing: 18-Year-Old Sentenced to Probation for Sexually Assaulting 2 Classmates in April
Now Playing: Dad Coach Knocks It Out of the Park Telling Son He Loves Him During Little League World Series
Now Playing: Outrage Over Skyrocketing Cost of Life-Saving EpiPens
Now Playing: Authorities Comb Through Video of Deadly Police Shooting That Killed a Deaf Man
Now Playing: Families Lose Everything to Out-of-Control Wildfires Near Spokane, Washington
Now Playing: {{itm.title}}