Quantcast
Channel: PowerShell.org » All Posts
Viewing all articles
Browse latest Browse all 13067

Reply To: Copying Images(.JPG) to a Zip Folder prior to Sftp

$
0
0

I’m not familiar with the Copy-ImageToOrganizedFolder command or where you’re getting it from, so I can’t help you much there. It looks like maybe you’re trying to use two different variable names for the same thing ($Source and $Images), since in your post, $Images seems to match the description of what you say is in $Source.

Based on what I can see, here’s how I’d modify your code:

Get-ChildItem -Path C:\Photos\*.jpg |
ForEach-Object {
    Copy-ImageToOrganizedFolder -Path $_.FullName
    Start-Sleep -Milliseconds 2000
}

It’s entirely possible that the Copy-ImageToOrganizedFolder command accepts pipeline input, which might eliminate the need for the ForEach-Object loop (you might be able to just pipe Get-ChildItem straight to Copy-ImageToOrganizedFolder.) I’m not sure what the purpose of the 2-second sleep is inside the loop, so I left it alone.


Viewing all articles
Browse latest Browse all 13067

Trending Articles