WebFaction
Community site: login faq

Hello,

I'm want to copy an entire application from one folder to another folder, to create a copy of the site and modify it.

What is the terminal command line to do this?

For example, I want to copy the content from webapps/site1 to webapps/site2 ?

Thanks for any help.

asked 22 Aug '11, 16:13

denis
11179
accept rate: 0%


You can normally copy directories with "cp -R", but it gets a bit tricky because root owns the ~/webapps directory (which means you can't create directories directly in ~/webapps yourself). Copying the contents of directories works, but can be tricky if you have dotfiles in the top level of the directory that you're trying to copy.

You can use rsync as a workaround, as long as you've created the site2 app first. This command will delete everything that exists in ~/webapps/site2 and then duplicate ~/webapps/site1 into it:

rsync --delete -a ~/webapps/site1/ ~/webapps/site2/

If you don't want to delete everything in ~/webapps/site2 first, then use this:

rsync -a ~/webapps/site1/ ~/webapps/site2/

Hope that helps!

permanent link

answered 22 Aug '11, 17:10

seanf
12.2k42136
accept rate: 37%

That s awesome, thanks a bunch, worked like a charm.

(23 Aug '11, 14:58) denis

Thank you very much!

(29 Oct '12, 21:25) realdeal

You can do this with cp -r.

For example:

shopt -s dotglob
cp -r webapps/site1/* webapps/site2/
shopt -u dotglob

This will copy the contents of site1/ to site2/, including hidden files (due to the dotglob).

permanent link

answered 29 Oct '12, 22:08

ryans ♦♦
5.0k93460
accept rate: 43%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×103
×5
×4

question asked: 22 Aug '11, 16:13

question was seen: 21,018 times

last updated: 29 Oct '12, 22:08

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM