[Help] Script for creating a folder, and then pasting other folders into it.

Discussion in 'Scripting' started by SalviaSage, Apr 22, 2018.

Tags:
  1. SalviaSage

    SalviaSage MDL Novice

    Apr 9, 2018
    29
    0
    0
    Hi. I got this idea for a .batch script.

    Basically, it makes a folder in a certain directory, only if this folder doesn't exist of course.

    And then, it copies some folders from another directory into it.

    And yes, I seriously need to try to learn batch...
     
  2. TairikuOkami

    TairikuOkami MDL Addicted

    Mar 15, 2014
    734
    614
    30
    Code:
    md "Z:\Pictures"
    xcopy "E:\Software\Temp\Pics" "Z:\Pictures" /s /y
    You can look at those, but CMD is being deprecated soon, you better learn powershell instead.

    https://www.computerhope.com/batch.htm
    https://ss64.com/nt
     
  3. Chibi ANUBIS

    Chibi ANUBIS MDL Chibi Developer

    Apr 28, 2014
    759
    425
    30
    Code:
    @echo off
    SET Source=E:\Software\Temp\Pics
    SET Target=Z:\Pictures
    
    if not exist "%Target%" mkdir "%Target%"
    xcopy "%Source%" "%Target%" /s /y
    
    exit
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. SalviaSage

    SalviaSage MDL Novice

    Apr 9, 2018
    29
    0
    0
    Thanks for your reply. I will be testing this.
     
  5. pf100

    pf100 MDL Expert

    Oct 22, 2010
    1,159
    1,555
    60
    I've never heard of, and can't find, any information about CMD and batch script being removed from windows. Do you have a link?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. keyword

    keyword MDL Novice

    May 13, 2017
    2
    0
    0
    why dont you use python script it's easy to manipulate path and file.
     
  7. SalviaSage

    SalviaSage MDL Novice

    Apr 9, 2018
    29
    0
    0
    Hi. Thanks for your input. I do not know python unfortunately and batch seemed like a good option.
    But, I can see how this task can be accomplished with python as well.