Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Using Xcopy for copy from filelist?  (Read 5770 times)

0 Members and 1 Guest are viewing this topic.

ElfMajesty

    Topic Starter


    Starter

    Using Xcopy for copy from filelist?
    « on: June 30, 2009, 06:02:36 AM »
    Good morning.  I'm hoping someone here can help me out.  By way of preface, I'm no expert in scripting, and I'm not a programmer.  Nor am I in a class trying to get an answer to a question for free.  :)  I'm in Litigation Technology and have a situation that I've run into before.  I've done quite of bit of research into it and thought I had a solution, but could use a bit of assistance.

    I'm trying to use an xcopy.bat to copy a specific list of files to a new drive keeping the folder structure intact.  It is working very well except for one minor exception.  I seem to be getting one extra folder at the end of each copy which is the file name itself. 

    For example, my list is:

    Folder1\docIneedcopied.doc
    Folder1\doc2needingcopy.xls
    Folder1\MyFiles\another file I need.doc


    I am getting for a result in the new drive:

    Folder1\docIneedcopied\docIneedcopied.doc
    Folder1\doc2needingcopy\doc2needingcopy.xls
    Folder1\MyFiles\another file I need\another file I need.doc

    The script I have for the bat is:
    for /f "delims=" %%i in (filelist.txt) do echo D|xcopy "C:\%%i" "E:\%%i" /i /z /y

    Can anyone advise where I've gone wrong in this script or is that just the way it works?

    I also have Robocopy, but couldn't get that script to work at all.

    Any other advice or ideas (keeping in mind I'm a learning-in-progress!) would be very much appreciated. 

    Cheers,
    L. Burr


    ElfMajesty

      Topic Starter


      Starter

      Re: Using Xcopy for copy from filelist?
      « Reply #1 on: June 30, 2009, 07:30:46 AM »
      Folks,

      After trolling through the boards a bit more extensively, I came across this following topic which seems to do exactly what I need.  I've tested on a few files and am now about to run it on my active data.   :)

      http://www.computerhope.com/forum/index.php/topic,84246.0.html

      Thanks to all.

      L. Burr


      BC_Programmer


        Mastermind
      • Typing is no substitute for thinking.
      • Thanked: 1140
        • Yes
        • Yes
        • BC-Programming.com
      • Certifications: List
      • Computer: Specs
      • Experience: Beginner
      • OS: Windows 11
      Re: Using Xcopy for copy from filelist?
      « Reply #2 on: June 30, 2009, 10:03:23 AM »
      Welcome to the forum! Good to see you might have a solution from a previous thread. Be sure to post your results or if you need further assistance.  :)
      I was trying to dereference Null Pointers before it was cool.