How Do I select multiple files in a folder from a list of file names

Page 1 of 4 123 ... LastLast

  1. Posts : 5
    Win10
       #1

    How Do I select multiple files in a folder from a list of file names


    HI,
    I have a folder containing 9,987 .jpg's of which I need to copy about 500 of to a different folder. I have the file names in a .txt file on separate lines as well as in a .csv worksheet. I don't want to find them individually to select/copy them.

    Also, I'm only a little better than the average monkey at manipulating windows beyond the average use.

    Thank you in advance for your help!
    -Rick
      My Computer


  2. Posts : 8,101
    windows 10
       #2

    In the tx file write infront of the file name
    copy
    then after it c:\weretogo
    so if it was
    bat.jpg
    it will be

    copy bat.jog c:\myfolder

    you can copy and paste the txt simpler in excel

    then save the file as back.cmd in the folder containing all the files and run it
      My Computer


  3. Posts : 13,993
    Win10 Pro and Home, Win11 Pro and Home, Win7, Linux Mint
       #3

    The tried and true methods, there's 3, is one to click the first file in a list, scroll down to the last one desired, hold down the Ctrl key and click the last one, selects all the files between from the first to the last. The second is to hold down the Ctrl key and click individual files in a random order, where not alphabetized. The third is to use Ctrl plus A to select All files in the Folder. Once selected use Ctrl plus C to Copy, Ctrl plus V to Paste to a different location. Or right-click the selections to Copy or Move then Paste.
      My Computers


  4. Posts : 31,611
    10 Home x64 (22H2) (10 Pro on 2nd pc)
       #4

    Welcome to TenForums @SGTOOL

    The simplest way to use a text file with a filename on each line (such as list.txt) to copy the files to a folder such as C:\Destination is by using this single command in a command prompt:

    FOR /F "delims=" %N in (list.txt) do COPY "%N" C:\Destination

    'for' loops through all the filenames in list.txt
    "delims=" says use the whole of each line as the parameter %N
    the quotes around %N in 'copy "%N"' allows for any filenames that contain spaces
    C:\Destination specifies the folder you want to copy to (it must already exist, create it first if necessary)

    If the text file contains just the file names, then the command has to be run in the folder that contains the files to be copied. To go to that folder, first use the 'change directory' command: CD <full path to the folder>
    eg: CD C:\Source_folder

    If the text file contains the full path and filename on each line, eg:
    C:\Users\Me\Pictures\SourceFiles\Filename.jpg
    ...then the CD step is not needed.

    If the text file is in a different folder, give the full path to it in the FOR command, eg: (C:\Temp\list.txt)
    Last edited by Bree; 16 May 2018 at 19:29. Reason: more explanation
      My Computers


  5. Posts : 5
    Win10
    Thread Starter
       #5

    Thank Bree
    I will try this tomorrow when I get to my office.
    My list.txt is in the source folder and only includes file names, no path.
    Do I create a target folder in the source folder prior?
      My Computer


  6. Posts : 31,611
    10 Home x64 (22H2) (10 Pro on 2nd pc)
       #6

    SGTOOL said:
    My list.txt is in the source folder and only includes file names, no path.
    Do I create a target folder in the source folder prior?
    Yes, create the target folder first.

    You can create the target folder anywhere you want as long as you use the full path in the FOR command. If you CD into the source folder and you have created the target folder is in the source folder too, then you just need to give its name.

    FOR /F "delims=" %N in (list.txt) do COPY "%N" Target
      My Computers


  7. Posts : 5
    Win10
    Thread Starter
       #7

    Good Morning @Bree,

    I've tried a couple different ways with nothing happening when I run as administrator.
    Here is my configuration:

    SOURCE: C:\Users\admin\OneDrive\Website FESTOOL\Images\TTS_MAM Low Res\Festool_Picture_Online_Zoom_04_2018

    LIST: List.txt (which is in source folder)

    CODE: Copy_Code.bat (which is in source folder)

    TARGET FOLDER NAMED: Target (which is in source folder)

    See image below.

    I Put these lines in my 'Copy_Code.bat' file:

    CD C:\Users\admin\OneDrive\Website FESTOOL\Images\TTS_MAM Low Res\Festool_Picture_Online_Zoom_04_2018

    FOR /F "delims=" %N in (list.txt) do COPY "%N" C:\Users\admin\OneDrive\Website FESTOOL\Images\TTS_MAM Low Res\Festool_Picture_Online_Zoom_04_2018\Target


    Thank you again for your help!

    How Do I select multiple files in a folder from a list of file names-copyfiles.jpg
      My Computer


  8. Posts : 31,611
    10 Home x64 (22H2) (10 Pro on 2nd pc)
       #8

    @SGTOOL, the % character is a special character and will be interpreted differently if you put the command in a batch file to run it. For example, you can call a batch file and pass up to 9 parameters to it, these are available in the batch file as %1 to %9 (%0 is the name of the batch file).

    The command I gave was written for running directly from the command prompt, for use in a batch file you need to 'escape' the % character by typing it twice, eg: use %%N in the batch file wher you would use %N on the command line. The first % is interpreted by the batch file processing, which strip out the first % and pass the second % to the command line it will run.
      My Computers


  9. Posts : 5
    Win10
    Thread Starter
       #9

    Thank you @Bree
    I added the % character and the command prompt window open briefly, scrolled through many lines then closed - nothing copied to \target.

    In the command prompt window I pasted the original command with one % character and got the same results.

    It displayed an error after each attempt of each file name ' The syntax of the command is incorrect'
    How Do I select multiple files in a folder from a list of file names-copyfiles2.jpg
      My Computer


  10. Posts : 31,611
    10 Home x64 (22H2) (10 Pro on 2nd pc)
       #10

    SGTOOL said:
    ... the command prompt window open briefly, scrolled through many lines then closed...
    You can add the PAUSE command as the last line in the batch file to keep the window open until you hit any key.

    ...It displayed an error after each attempt of each file name ' The syntax of the command is incorrect'
    You are deep down in the directory structure there, and if you included the full path to the text file and for the target folder this may have caused your problems (too long a command line?).

    As your Target is a subfolder of the directory you are running the command from you don't need the full path, it is assumed that you mean a folder in the current path. Same for the text file, make sure it's in the source folder so you can just use the filename without a path. Try this at the command prompt...

    FOR /F "delims=" %N in (textfile.txt) do COPY "%N" Target

    How Do I select multiple files in a folder from a list of file names-copy.png
      My Computers


 

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

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




Windows 10 Forums