Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8673077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:21:53+00:00 2026-06-12T19:21:53+00:00

I already spent hours on this problem, but I didn’t succeed in finding a

  • 0

I already spent hours on this problem, but I didn’t succeed in finding a working solution.

Here is my problem description:

I’m a newbie in powershell, somehow I read books and made a required code but it is showing errors which i cant sort out. What the code does it fetches images from a folder and places copy of each image according to the closest available ratio (0.67,1.33,1.2) compared to the image aspect ratio in the folders(0.67,1.33,1.2) to some other location.

My code looks more or less like this:

[System.Reflection.Assembly]::LoadFile( "C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll")  



#index of minimum value
$p = [array]::IndexOf($ratioarray, $minimum)

if($p -eq 0){
$dst_dir =  $des_dir+"powershell\0.4"
if (!(Test-Path $dst_dir)) {
 # create it
 [void](new-item $dst_dir -itemType directory)
 }
Copy-Item $src_dir$image $dst_dir
}

if($p -eq 1){
$dst_dir =  $des_dir+"powershell\0.5"
if (!(Test-Path $dst_dir)) {
 # create it
 [void](new-item $dst_dir -itemType directory)
 }
Copy-Item $src_dir$image $dst_dir
}

if($p -eq 2){
$dst_dir =  $des_dir+"powershell\0.67"
if (!(Test-Path $dst_dir)) {
 # create it
 [void](new-item $dst_dir -itemType directory)
 }
Copy-Item $src_dir$image $dst_dir
}

"$name|$width|$height|$ratioroundoff|$dst_dir" >> $datafile  

     $imageFile.Dispose() 
 }

It gives error:

Copy-Item : The given path's format is not supported.
At C:\Users\busy\desktop\copyflow.ps1:71 char:10
+ Copy-Item <<<<  $src_dir$image $dst_dir
+ CategoryInfo : InvalidOperation: (C:\Users\busy\D...ics2\jack.jpg:String) [Copy-Item], NotSupportedException
+ FullyQualifiedErrorId : ItemExistsNotSupportedError,Microsoft.PowerShell.Commands.CopyItemCommand 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T19:21:55+00:00Added an answer on June 12, 2026 at 7:21 pm

    The problem seems to be with file names. $images = Get-ChildItem -Recurse $src_dir -Include *.jpg will populate a collection with FileInfo objects that already have absolute file names present. No path mangling is needed.

    Instead of

    Copy-Item $src_dir$image $dst_dir
    

    Try something like

    Copy-Item $image.FullName $dst_dir
    

    If it still doesn’t work, print output to console and check what is wrong. Like so,

    write-host $("Copy-Item {0} {1}" -f $image.FullName, $dst_dir)
    Copy-Item -whatif $image.FullName $dst_dir
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I already spent hours on this problem, but I didn't succeed in finding a
I spend already some hours on this problem and cannot find solution. I have
I'v spent already a few hours to figure out this query but no result,
I have a problem with php header redirect. I already spent hours trying to
I've already spent countless hours puzzling over this, utilizing Google searches and other Stack
I know that this question was asked millions of times, but i already spent
I have spent 5 hours on this, and I've already been up 30 hours
I have spent hours on this problem, I hope somebody can help me. Sorry
I was sure there was an answer to this question already but I've spent
Already 2 hours I spent on Google to find this content slider. No luck.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.