Struggling with CMD - Copy


  1. Posts : 4
    Windows 7 x64 and windows 10 x32
       #1

    Struggling with CMD - Copy


    Hello SF world,

    I recently thought I found a fix for my issue on this forum, sadly it did not work
    So none the less I'd like to try asking my specific issue.

    Summary
    I need to copy over 1000 files that are all in PDF from a shared drive that has a few hundred TB of data.
    I've been given a list of unique identifiers(all #s) for the ones I need however the files I need contain both a numerical value and 1 or 2 alphabetic ones additionally some may have the hyphen between numbers and letters.

    Information
    I know the exact root folder path thing is my desired PDFs may be located in 2-3 sub-folders if not more...
    (Let's call the shared Drive T: )
    Just to get an idea of what mapping i'm dealing with T: will break into many folders which i'm not concerned about that since I know exactly which 1st sub-folder they should be in
    Once i'm in my folder I hit a dead end as my desired files may could be in Folder 1,2,3,30,40,50.
    I have no way of knowing exactly where they are other than searching one by one... but we all know how time consuming that is.

    I've tried a few variations to attempt to locate them;

    First from an excel sheet I converted to *.bat

    Command Output: Current Folder Path File Name Enter Destination Folder Path Below
    COPY "T:\Main\Test1test.pdf" XXXXXX "T:\Main\Test2"

    Then I tried my luck with CMD after spending quite sometime on google;

    @echo off

    set LISTFOLDER=T:\Main\Test1
    set FILESPATH=T:\Main\Test1\Filelist
    set DESTPATH=T:\Main\Test2

    for /f "tokens=*" %%i in ('dir /b ^"%LISTFOLDER%\*.txt^"') do (call :COPY_FILES "%LISTFOLDER%\%%i")

    pause
    exit

    :COPY_FILES
    for %%i in (%1) do set DEST=%%~ni
    for /f "usebackq delims==" %%i in (%1) do xcopy /qv "%FILESPATH%\%%i" "%DESTPATH%\%DEST%\*"

    No luck either. I'm not any good with CMD as I've never learned it (though now I wish I had...)

    Desired resolution
    I'd like to have someone show me where am going wrong by giving me the proper cmd, I understand that a wildcard value might help but would this be any good for both hyphens and alphabetical values after the numbers most files should not have any spaces but then again I'd rather cover all angles.

    Thanks in advance to whoever replies,
      My Computer


  2. Posts : 1,784
    Linux Mint 18.2 xfce 64-bit (VMWare host) / Windows 8.1 Pro 32-bit (VMWare guest)
       #2

    The easiest way to get a listing of all of the PDF files which are on your shared drive is to use the DIR command to generate a text file listing of all of the files. We will do everything from a command prompt, so open a command prompt.

    If you don't have a TEMP folder on your C: drive, create one.
    Type MD C:\TEMP [ENTER]

    Now generate a listing of all of the PDF files on your shared drive.
    DIR T:\*.PDF /s > C:\TEMP\pdflist.txt

    * The '/s' tells the DIR command to look in all subdirectories on drive T:.
    * The '>' directs the output of the command to the text file that appears after it.

    Now you have a text file which contains a listing of every PDF file on your T: drive.

    At this point, you'll need to look at the file listing to see where all of the PDF files are, so you'll know best how to proceed with the actual copy process. I wouldn't get too fancy or complicated with a batch file; you'd probably be better off just doing the copy manually using File Explorer in Windows.
      My Computer


  3. Posts : 4
    Windows 7 x64 and windows 10 x32
    Thread Starter
       #3

    Thanks for the DIR suggestion, I never thought of that.

    I still feel there should be a better way then to manually copy over 1000 files.

    I understand the whole KISS principle, but is there a cmd function that could copy from the list I'll filter out once the -DIR is finished compiling the information ?
      My Computer


  4. Posts : 3,788
    win 8 32 bit
       #4

    There are lots of free search programs that will do this then let you copy the results better still is a free file manager with super fast search and you can then copy files within manager Alternative to Windows Search For Files + Duplicates Search
      My Computer


  5. Posts : 4
    Windows 7 x64 and windows 10 x32
    Thread Starter
       #5

    samuria said:
    There are lots of free search programs that will do this then let you copy the results better still is a free file manager with super fast search and you can then copy files within manager Alternative to Windows Search For Files + Duplicates Search
    wish I could sadly this is a corporate device 3rd party applications are a no go, my Dir search has been running for about an hour now guess I'll have to keep on waiting
      My Computer


  6. Posts : 4
    Windows 7 x64 and windows 10 x32
    Thread Starter
       #6

    mrjimphelps said:
    The easiest way to get a listing of all of the PDF files which are on your shared drive is to use the DIR command to generate a text file listing of all of the files. We will do everything from a command prompt, so open a command prompt.

    If you don't have a TEMP folder on your C: drive, create one.
    Type MD C:\TEMP [ENTER]

    Now generate a listing of all of the PDF files on your shared drive.
    DIR T:\*.PDF /s > C:\TEMP\pdflist.txt

    * The '/s' tells the DIR command to look in all subdirectories on drive T:.
    * The '>' directs the output of the command to the text file that appears after it.

    Now you have a text file which contains a listing of every PDF file on your T: drive.

    At this point, you'll need to look at the file listing to see where all of the PDF files are, so you'll know best how to proceed with the actual copy process. I wouldn't get too fancy or complicated with a batch file; you'd probably be better off just doing the copy manually using File Explorer in Windows.

    Is it suppose to take quite a while to complete ?
      My Computer


  7. Posts : 3,788
    win 8 32 bit
       #7

    The file manager is portable so is the other so no need to install can run from usb
      My Computer


 

  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 19:36.
Find Us