How to: Command line directory duplication?How can I copy the contents of a folder to another folder in a different directory using terminal?Is there a command-line utility app which can find a specific block of lines in a text file, and replace it?How do I rename a directory via the command line?How do I delete all empty directories in a directory from the command line?How do I change directories from the command line?Linux Touch Directory CommandRecursively copy (and rename) files to their own same directory with another nameHidden files found only by command line?How to do command line search for duplicate downloads within downloads folder?How can I recursively make a directory in the last directories using the command line?Duplication of songs in players

Make Interviewee Comfortable in Potentially Intimate Environment

Are there hydrocarbons on the Moon?

How to influence manager to not schedule team meetings during lunch?

Asking an expert in your field that you have never met to review your manuscript

Did HaShem ever command a Navi (Prophet) to break a law?

Is Zack Morris's 'time stop' ability in "Saved By the Bell" a supernatural ability?

Are lay articles good enough to be the main source of information for PhD research?

How to bypass when network speed over a special number in Juniper?

What do solvers like Gurobi and CPLEX do when they run into hard instances of MIP

Simulate a 1D Game-of-Life-ish Model

I reverse the source code, you negate the input!

CDG baggage claim before or after immigration?

Do liquid propellant rocket engines experience thrust oscillation?

Debussy as term for bathroom?

Can one guy with a duplicator initiate a nuclear apocalypse?

What did the controller say during my approach to land (audio clip)?

Can Northern Ireland's border issue be solved by repartition?

Should the pagination be reset when changing the order?

Removing rows containing NA in every column

How could artificial intelligence harm us?

Which museums have artworks of all four ninja turtles' namesakes?

Manager manipulates my leaves, what's in it for him?

Temporarily moving a SQL Server 2016 database to SQL Server 2017 and then moving back. Is it possible?

I reverse the source code, you negate the output!



How to: Command line directory duplication?


How can I copy the contents of a folder to another folder in a different directory using terminal?Is there a command-line utility app which can find a specific block of lines in a text file, and replace it?How do I rename a directory via the command line?How do I delete all empty directories in a directory from the command line?How do I change directories from the command line?Linux Touch Directory CommandRecursively copy (and rename) files to their own same directory with another nameHidden files found only by command line?How to do command line search for duplicate downloads within downloads folder?How can I recursively make a directory in the last directories using the command line?Duplication of songs in players






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I use terminal/the command line on a daily basis for front end web development.



As an example: Today, from the command-line I was trying duplicate a project to make a responsive web page design from a non-responsive template I had created. I know you can use cp -a /source/. /dest/ like shown here to copy files but it isn't quite duplication.



Instead of copying; inside of directory X I wanted to duplicate directory A so I have directory A and directory A(1) side by side.



I know I could quickly do this in the GUI but for the sake of a streamlined workflow I got curious.



So, would copying (cp) the directory to the same folder accomplish the same thing or this also void?



Is direct duplication at the command-line not possible or is there a certain way you have to go about it?



Thanks.










share|improve this question





















  • 2





    mkdir -p path/to/original/dir2/ ; cp -r /path/to/original/dir/ /path/to/original/dir2/ should do the trick

    – Wayne_Yux
    Oct 30 '15 at 9:23











  • Please leave me a comment, if it works then I will add some explanation to the commands and add it as an answer

    – Wayne_Yux
    Oct 30 '15 at 9:59











  • @Wayne_Yux I made a dummy folder and inside made dir and then typed mkdir dir2/ ; cp -r dir1 dir2 and it worked all in one go. Thanks, I'll be sure to use this next time my terminal usage calls for it! Switching out and going through all the folders takes a bit of time compared to this!

    – ConstantFun
    Nov 1 '15 at 14:53

















1















I use terminal/the command line on a daily basis for front end web development.



As an example: Today, from the command-line I was trying duplicate a project to make a responsive web page design from a non-responsive template I had created. I know you can use cp -a /source/. /dest/ like shown here to copy files but it isn't quite duplication.



Instead of copying; inside of directory X I wanted to duplicate directory A so I have directory A and directory A(1) side by side.



I know I could quickly do this in the GUI but for the sake of a streamlined workflow I got curious.



So, would copying (cp) the directory to the same folder accomplish the same thing or this also void?



Is direct duplication at the command-line not possible or is there a certain way you have to go about it?



Thanks.










share|improve this question





















  • 2





    mkdir -p path/to/original/dir2/ ; cp -r /path/to/original/dir/ /path/to/original/dir2/ should do the trick

    – Wayne_Yux
    Oct 30 '15 at 9:23











  • Please leave me a comment, if it works then I will add some explanation to the commands and add it as an answer

    – Wayne_Yux
    Oct 30 '15 at 9:59











  • @Wayne_Yux I made a dummy folder and inside made dir and then typed mkdir dir2/ ; cp -r dir1 dir2 and it worked all in one go. Thanks, I'll be sure to use this next time my terminal usage calls for it! Switching out and going through all the folders takes a bit of time compared to this!

    – ConstantFun
    Nov 1 '15 at 14:53













1












1








1


1






I use terminal/the command line on a daily basis for front end web development.



As an example: Today, from the command-line I was trying duplicate a project to make a responsive web page design from a non-responsive template I had created. I know you can use cp -a /source/. /dest/ like shown here to copy files but it isn't quite duplication.



Instead of copying; inside of directory X I wanted to duplicate directory A so I have directory A and directory A(1) side by side.



I know I could quickly do this in the GUI but for the sake of a streamlined workflow I got curious.



So, would copying (cp) the directory to the same folder accomplish the same thing or this also void?



Is direct duplication at the command-line not possible or is there a certain way you have to go about it?



Thanks.










share|improve this question
















I use terminal/the command line on a daily basis for front end web development.



As an example: Today, from the command-line I was trying duplicate a project to make a responsive web page design from a non-responsive template I had created. I know you can use cp -a /source/. /dest/ like shown here to copy files but it isn't quite duplication.



Instead of copying; inside of directory X I wanted to duplicate directory A so I have directory A and directory A(1) side by side.



I know I could quickly do this in the GUI but for the sake of a streamlined workflow I got curious.



So, would copying (cp) the directory to the same folder accomplish the same thing or this also void?



Is direct duplication at the command-line not possible or is there a certain way you have to go about it?



Thanks.







command-line directory duplicate






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 13 '17 at 12:23









Community

1




1










asked Oct 30 '15 at 9:19









ConstantFunConstantFun

1126 bronze badges




1126 bronze badges










  • 2





    mkdir -p path/to/original/dir2/ ; cp -r /path/to/original/dir/ /path/to/original/dir2/ should do the trick

    – Wayne_Yux
    Oct 30 '15 at 9:23











  • Please leave me a comment, if it works then I will add some explanation to the commands and add it as an answer

    – Wayne_Yux
    Oct 30 '15 at 9:59











  • @Wayne_Yux I made a dummy folder and inside made dir and then typed mkdir dir2/ ; cp -r dir1 dir2 and it worked all in one go. Thanks, I'll be sure to use this next time my terminal usage calls for it! Switching out and going through all the folders takes a bit of time compared to this!

    – ConstantFun
    Nov 1 '15 at 14:53












  • 2





    mkdir -p path/to/original/dir2/ ; cp -r /path/to/original/dir/ /path/to/original/dir2/ should do the trick

    – Wayne_Yux
    Oct 30 '15 at 9:23











  • Please leave me a comment, if it works then I will add some explanation to the commands and add it as an answer

    – Wayne_Yux
    Oct 30 '15 at 9:59











  • @Wayne_Yux I made a dummy folder and inside made dir and then typed mkdir dir2/ ; cp -r dir1 dir2 and it worked all in one go. Thanks, I'll be sure to use this next time my terminal usage calls for it! Switching out and going through all the folders takes a bit of time compared to this!

    – ConstantFun
    Nov 1 '15 at 14:53







2




2





mkdir -p path/to/original/dir2/ ; cp -r /path/to/original/dir/ /path/to/original/dir2/ should do the trick

– Wayne_Yux
Oct 30 '15 at 9:23





mkdir -p path/to/original/dir2/ ; cp -r /path/to/original/dir/ /path/to/original/dir2/ should do the trick

– Wayne_Yux
Oct 30 '15 at 9:23













Please leave me a comment, if it works then I will add some explanation to the commands and add it as an answer

– Wayne_Yux
Oct 30 '15 at 9:59





Please leave me a comment, if it works then I will add some explanation to the commands and add it as an answer

– Wayne_Yux
Oct 30 '15 at 9:59













@Wayne_Yux I made a dummy folder and inside made dir and then typed mkdir dir2/ ; cp -r dir1 dir2 and it worked all in one go. Thanks, I'll be sure to use this next time my terminal usage calls for it! Switching out and going through all the folders takes a bit of time compared to this!

– ConstantFun
Nov 1 '15 at 14:53





@Wayne_Yux I made a dummy folder and inside made dir and then typed mkdir dir2/ ; cp -r dir1 dir2 and it worked all in one go. Thanks, I'll be sure to use this next time my terminal usage calls for it! Switching out and going through all the folders takes a bit of time compared to this!

– ConstantFun
Nov 1 '15 at 14:53










1 Answer
1






active

oldest

votes


















2
















You can do it simply:



cp -r path/to/original/dir1 path/to/original/newdir1


e.g: directory_A1 does not exist but is created when specified in the command:



cp -r /home/me/Documents/directory_A /home/me/Documents/directory_A1


If you want 'directory_A(1)': Surround the second path in quotes.



cp -r /home/me/Documents/directory_A "/home/me/Documents/directory_A(1)"





share|improve this answer





























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "89"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );














    draft saved

    draft discarded
















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f691827%2fhow-to-command-line-directory-duplication%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2
















    You can do it simply:



    cp -r path/to/original/dir1 path/to/original/newdir1


    e.g: directory_A1 does not exist but is created when specified in the command:



    cp -r /home/me/Documents/directory_A /home/me/Documents/directory_A1


    If you want 'directory_A(1)': Surround the second path in quotes.



    cp -r /home/me/Documents/directory_A "/home/me/Documents/directory_A(1)"





    share|improve this answer































      2
















      You can do it simply:



      cp -r path/to/original/dir1 path/to/original/newdir1


      e.g: directory_A1 does not exist but is created when specified in the command:



      cp -r /home/me/Documents/directory_A /home/me/Documents/directory_A1


      If you want 'directory_A(1)': Surround the second path in quotes.



      cp -r /home/me/Documents/directory_A "/home/me/Documents/directory_A(1)"





      share|improve this answer





























        2














        2










        2









        You can do it simply:



        cp -r path/to/original/dir1 path/to/original/newdir1


        e.g: directory_A1 does not exist but is created when specified in the command:



        cp -r /home/me/Documents/directory_A /home/me/Documents/directory_A1


        If you want 'directory_A(1)': Surround the second path in quotes.



        cp -r /home/me/Documents/directory_A "/home/me/Documents/directory_A(1)"





        share|improve this answer















        You can do it simply:



        cp -r path/to/original/dir1 path/to/original/newdir1


        e.g: directory_A1 does not exist but is created when specified in the command:



        cp -r /home/me/Documents/directory_A /home/me/Documents/directory_A1


        If you want 'directory_A(1)': Surround the second path in quotes.



        cp -r /home/me/Documents/directory_A "/home/me/Documents/directory_A(1)"






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Apr 15 at 12:52









        ConstantFun

        1126 bronze badges




        1126 bronze badges










        answered Oct 30 '15 at 10:27









        gentoozagentooza

        1038 bronze badges




        1038 bronze badges































            draft saved

            draft discarded















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f691827%2fhow-to-command-line-directory-duplication%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Tamil (spriik) Luke uk diar | Nawigatjuun

            Align equal signs while including text over equalitiesAMS align: left aligned text/math plus multicolumn alignmentMultiple alignmentsAligning equations in multiple placesNumbering and aligning an equation with multiple columnsHow to align one equation with another multline equationUsing \ in environments inside the begintabularxNumber equations and preserving alignment of equal signsHow can I align equations to the left and to the right?Double equation alignment problem within align enviromentAligned within align: Why are they right-aligned?

            Training a classifier when some of the features are unknownWhy does Gradient Boosting regression predict negative values when there are no negative y-values in my training set?How to improve an existing (trained) classifier?What is effect when I set up some self defined predisctor variables?Why Matlab neural network classification returns decimal values on prediction dataset?Fitting and transforming text data in training, testing, and validation setsHow to quantify the performance of the classifier (multi-class SVM) using the test data?How do I control for some patients providing multiple samples in my training data?Training and Test setTraining a convolutional neural network for image denoising in MatlabShouldn't an autoencoder with #(neurons in hidden layer) = #(neurons in input layer) be “perfect”?