Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2003
    Location
    Kalamazoo
    Posts
    42

    Unanswered: MS-DOS COPY problem

    Hi,
    I want to create a batch file which copies existing files in one directory to another directory(actually sub-directories in the second directory) based on the dates they were created using MS-DOS command.
    Example:
    File A created on Jan-10-03
    File B created on Dec-12-97
    File A & B are in C:/ drive and when I run the batch file the File A should be copied to d:/Jan & File B should be copied to D:/Dec

    Please let me know!
    Thanks.

  2. #2
    Join Date
    Jul 2002
    Location
    Village, MD
    Posts
    621
    Use xp_cmdshell ....

  3. #3
    Join Date
    Sep 2003
    Location
    Kalamazoo
    Posts
    42
    Could you please elaborate....I am kind of new to the IT field.
    Thank you.


    Originally posted by snail
    Use xp_cmdshell ....

  4. #4
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    xp_cmdshell allows you to issue commands to the operating system just as if you were at a DOS prompt. xp_cmdshell must be called from the Master database. Look it up in Books Online for syntax and details.

    blindman

  5. #5
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809
    Doing this with CMD commands is going to be tuff. For this type of work I would suggest a scripting language like PERL, PYTHON or even good old qbasic! Of course you could do this with TSQL but this is not always the best solution for system scripting. Knowing one of the above languages will make short work of this kind of task.
    Paul Young
    (Knowledge is power! Get some!)

  6. #6
    Join Date
    Sep 2003
    Location
    Germany
    Posts
    63
    Hi,

    another possibility would be an ActiveXScript in a DTS package. For information about working with files in DTS refer to http://www.sqldts.com/default.aspx?292

    Bye,
    Carsten

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •