1

My question is very similar to this similar question on Linux.

I have received a catalog of images from Google Drive in multi-tiered (3 levels deep) sub directories that I need to upload to WordPress.

I thought it would be best to copy all images into 1 folder, making it easy to upload.

How do I move all images into 1 folder using a CMD command? (I'm on Windows 10)

7
  • Yes, thanks @PimpJuiceIT, but would prefer to copy files to a different directory - is that possible?
    – Steve
    Jul 24, 2019 at 7:30
  • Yeah, prefer the full code please @PimpJuiceIT, thank you.
    – Steve
    Jul 24, 2019 at 11:34
  • I've copied the code, altered the directory parameters, removed echo off, and I see the process completing okay inside the CMD window, but no files end up in the destination folder. This is my version.
    – Steve
    Jul 25, 2019 at 8:00
  • Sure. Here's a sample of the output.
    – Steve
    Jul 26, 2019 at 4:13
  • Also, the script ended up deleting the files from the source directory. I don't want it to do this.
    – Steve
    Jul 26, 2019 at 10:01

1 Answer 1

1

PowerShell

Get-ChildItem *.jpg -recurse | move-item -Destination 'C:\NewFolder'

PreCreate your destinaton folder or the command will fail.

5
  • Looks good Keith, thank you, but not all files were copied. The first source directory I opened had JPGs that weren't in the destination folder.
    – Steve
    Jul 24, 2019 at 7:31
  • And that's the directory you execuated the command from? Jul 24, 2019 at 14:01
  • Yes Keith, it is.
    – Steve
    Jul 25, 2019 at 8:01
  • Hard to guess without seeing examples. Are they listed when you try gci *.jpg? Jul 25, 2019 at 13:51
  • I ran the command again, and let it run for much longer. I think last time, I forgot about the running process, and shut the laptop lid, ending the process too soon. The 2nd time the process completed properly. Thanks.
    – Steve
    Jul 30, 2019 at 2:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .