How do I copy some multiple photos from one folder to another?

Copper Contributor

I have a list of names of photos that I have required to copy from one folder to another. How Can I do that?

 

List of Photos name that I have required to copy in a New Folder:-

krishank652_0-1623913987954.png

qa

List of Photos:-

krishank652_1-1623914020486.png

 

12 Replies

@krishank652 

 

Copy a picture or pictures

  1. Select the picture or pictures you want to copy.

  2. Click Home, and then click Copy 

     

     

    .

  3. Click the folder where you want to paste the copy, and then click Paste 

     
  • Alternatively, you can copy the picture by dragging it to another folder. If you want to move the picture rather than copy it, hold down SHIFT while you drag the picture to the new folder.

  • You can also copy a picture to another Microsoft Office program. Select the picture or pictures you want to copy, click Copy, witch to the other program, and then clickPaste.

 

I would be happy to know if I could help.

 

Nikolino

I know I don't know anything (Socrates)

* Kindly Mark and Vote this reply if it helps please, as it will be beneficial to more Community members reading here.

I want to filter out lists of photos that are given in the excel sheet.

Hi @krishank652 ,

 

$Pic =Import-Csv C:\folder\pics.csv -delimiter ';'

$pic2=$pics.Pictures

copy C:\folder\$pics2 C:\DestinationFolder\

Pay attention to give the csv file in the first row the right name, in my example "Pictures"

 

Schnittlauch_0-1623922244139.png

I hope I met your requirements

 

Best regards,
Schnittlauch

 

"First, No system is safe. Second, Aim for the impossible. Third, no Backup, no Mercy" - Schnittlauch

 

My answer helped you? Don't forget to leave a like. Also mark the answer as solved when your problem is solved. 🙂

 

@krishank652 

Please read this link before continuing

Welcome to your Excel discussion space!

 

How are you sure that what was written or copied in the Excel sheet also exists in the folder?
Here is a suggested solution with direct copying from folder to folder.

Option Explicit

Sub Copy()
  Dim rngC As Range
  Const cstrPfad1 As String = "c:\Bilder\"
  Const cstrPfad2 As String = "c:\Bilder\relevant\"
  If Dir(cstrPfad2, vbDirectory) = "" Then
    MkDir cstrPfad2
  End If
  For Each rngC In Range(Cells(2, 1), Cells(Rows.Count, 1).End(xlUp))
    Name cstrPfad1 & rngC As cstrPfad2 & rngC
  Next
End Sub

 

Can you share any full example. I don't understand How & where can I run this code?

@NikolinoDE 

I am using OS: Windows10 and Product: Microsoft office professional plus 2016 

Yes, photos exist in the folder and their names exist in the excel sheet.

I run this code in Macro. It's showing an error

krishank652_0-1623924916609.png

 

@krishank652 

As ordered 🙂

You have to specify the path in the code and the name of the new folder where you want to go.

Easy to do.

 

It worked for me without any problems (test under Excel 2016 and Windows 10, as desired).

 

I wish you a lot of fun with Excel.

 

I would be happy to know if I could help.

 

Nikolino

I know I don't know anything (Socrates)

 

I was using Excel+ powershell. Is this an option for you? If so, I will explain it.

@NikolinoDE 

 

amolbhosale_0-1652282772983.png

 

Please see the above error while running the macro. Please check

@amol bhosale 

Try this macro:

Sub CopyFiles()
    ' Folder containing the images. Path must end in \
    Const SourcePath = "C:\MyFiles\Source\"
    ' Folder to copy the images to. Path must also end in \
    Const TargetPath = "C:\MyFiles\Target\"
    Dim r As Long
    Dim LastRow As Long
    LastRow = Range("A" & Rows.Count).End(xlUp).Row
    For r = 1 To LastRow
        FileCopy SourcePath & Range("A" & r).Value, TargetPath & Range("A" & r).Value
    Next r
End Sub

your codding are working but some error is showing when we open the file.

can you check why this error are coming

AryanVerma1988_1-1663138200024.png

 

Thanks

@HansVogelaar 

@AryanVerma1988 

I don't think the code has anything to do with that.

Have you contacted your IT department?