Copying multiple files in a list, from one folder to another...

Page 1 of 4 123 ... LastLast

  1. Posts : 7
    Windows 7 x64
       #1

    Copying multiple files in a list, from one folder to another...


    I have an excel spreadsheet listing over 300 hundred pictures that I need to send to find.

    I know where all these images are located, but the folder they are in has thousands of other photos.

    Is there a way for me to easily find the picture on my excel list?
      My Computer


  2. Posts : 10,485
    W7 Pro SP1 64bit
       #2

    Welcome to the Seven Forums.

    What do you want to do with the picture once you find it?

    It should be possible to run batch file...
    ...the batch file reads the Excel list*
    ...the batch file copies** the photos of interest
    ...and puts then into a temporary folder on your desktop***.

    *assumes that the Excel file can be saved as text (CSV).
    **or moves or maybe a few other things
    ***or a different location/folder

    Does that sound like something that would help you?
      My Computer


  3. Posts : 7
    Windows 7 x64
    Thread Starter
       #3

    I will just need to email the files or put them on a zip drive to give to someone else.

    how do I write a batch file?
      My Computer


  4. Posts : 10,485
    W7 Pro SP1 64bit
       #4

    So - you are okay with these files being a copy of the original - correct?
    (e.g The original photos should stay where they are.)


    Are the photos all in one folder?
    (c:\photos\...)

    Or are they in multiple folders?
    (c:\photos\2010\...)
    (c:\photos\2011\...)
    (c:\photos\2012\...)

    If the photos are in multiple folders, can the batch file put the copies into one single folder for you to work with? Or do you need to keep them in the same type of folder structure?


    We will work on writing the batch file if I determine that a batch file is going to work best for you
      My Computer


  5. Posts : 7
    Windows 7 x64
    Thread Starter
       #5

    yes, a copy of the file is fine. They should all be in one folder, but there might be an instance where they are in different folders.
      My Computer


  6. Posts : 10,485
    W7 Pro SP1 64bit
       #6

    Okay - it is important that what I come up with works for every case that you will encounter.

    Sorry to keep asking questions...
    Can you save the spreadsheet as text so that it looks like this in notepad:
    [Within Excel, save the list of files as Text (MS-DOS)(*.txt).]
    photo1.jpg
    photo33.jpg
    photo88.jpg

    It sort of* does not matter what the file names are.

    *Are the file names simple letters/numbers?
    No special characters?


    The end goal of using a batch file or a script is:
    You create the text file that lists the photos to be found.
    You run the batch file or script.
    You will have a copy of all of the files of interest in a temp folder within seconds.
      My Computer


  7. Posts : 7
    Windows 7 x64
    Thread Starter
       #7

    Yes, I can make the spreadsheet a txt.

    File names are just letters and numbers. no spaces.
      My Computer


  8. Posts : 10,485
    W7 Pro SP1 64bit
       #8

    Is this on a work computer? If so, can you install AutoIt?

    Don't install it. I'm just asking if such is allowed.
      My Computer


  9. Posts : 7
    Windows 7 x64
    Thread Starter
       #9

    Yes, It's a work computer, but I can download programs.
      My Computer


  10. Posts : 10,485
    W7 Pro SP1 64bit
       #10

    Please watch these videos and see if this script is something that you can use:

    You might want to watch in the full screen mode and at 720p.


    The script only looks in one folder. If the script cannot locate one of the files, it pops up a box for you to copy the file name and paste it into the search box as shown in the video below.

    There is a way to make the script search each folder, but since you said that does not happen very often, I kept the script simple.

    If you want to try this script, then install AutoIt from here: AutoIt Downloads - AutoItScript
    Copying multiple files in a list, from one folder to another...-autoit-dl.png
    Accept the default settings during the installation.
    Then close the help file.
    The installer does not install extra junk programs

    After the installation completes...
    ...click on an empty spot on your desktop
    ...press F5 to refresh the desktop
    (so that the Explorer's context menu updates)
    ...right click on an empty spot on your desktop
    ...and select New > AutoIt v3 Script as shown in the first video
    (if AutoIt v3 Script is not shown in the context menu, restart the computer)
    ...name the newly created file whatever you want
    ...right click on that newly created file
    ...and select Edit Script from the context menu
    ...copy the code in the code box below and paste it into that file
    ...close/save the file.

    The video shows right clicking on the file and selecting Run Script. You can just double click to run the script.


    If the script ever hangs - you can kill it by clicking on the AutoIt icon down by the clock and selecting Exit.
    Code:
    Opt("TrayIconDebug", 1)
    
    $S_running = "find-copy-photos" ;name the script
    If WinExists($S_running) Then
        MsgBox(0, "AutoIt", "The script to find and copy photos is already running")
        Exit
    EndIf
    AutoItWinSetTitle($S_running)
    
    $FileName = FileOpenDialog("Select the file that contains the list of photos to find & copy", "C:\temp\", "Text File (*.txt)")
    If @error Then Exit
    
    $FileNameArray = StringSplit(FileRead($FileName), @CRLF, 1)
    
    $PhotoFolder = FileSelectFolder("Select the top level folder that contains the photos.", "")
    If @error Then Exit
    
    $search = FileFindFirstFile($PhotoFolder & "\*.*")
    If $search = -1 Then
        MsgBox(0, "Error", "No files/directories matched the search pattern")
        Exit
    EndIf
    While 1
        Local $file = FileFindNextFile($search)
        If @error Then ExitLoop
    
        For $i = 1 To $FileNameArray[0]
            If $file = $FileNameArray[$i] Then
                FileCopy($PhotoFolder & "\" & $file, @DesktopDir & "\output\", 8)
                $FileNameArray[$i] = ""
            EndIf
        Next
    WEnd
    
    
    For $i = 1 To $FileNameArray[0]
        If $FileNameArray[$i] <> "" Then
            InputBox("Error", "Could not find:", $FileNameArray[$i])
            If @error = 1 Then Exit
        EndIf
    Next
    
    Run("explorer.exe " & @DesktopDir & "\output\")
      My Computer


 
Page 1 of 4 123 ... LastLast

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 23:10.
Find Us