Copy a Directory from Command Line
Copying a directory for the sake of backup is something I do often, especially when I'm trying to figure out why something isn't working when I use an external library. I'll copy the directory structure as a backup, mess around with the original source until I find a solution, then restore the original and change my overall system code to bring in my revised version.
You can't just use cp
to copy a directory structure -- you'll see cp: myDir is a directory (not copied).
You'll need to add a few additional flags to copy a directory structure:
cp -Rp source source_copy
The above command copies the directory recursively while keeping the same permissions!
CSS animations aren't just for basic fades or sliding elements anymore -- CSS animations are capable of much more. I've showed you how you can create an exploding logo (applied with JavaScript, but all animation is CSS), an animated Photo Stack, a sweet...
Chances are that any Web designers using our Ghostlab browser testing app, which allows seamless testing across all devices simultaneously, will have worked with responsive design in some shape or form. And as today's websites and devices become ever more varied, a plethora of responsive images...
We all know that each browser vendor takes the liberty of implementing their own CSS and JavaScript features, and I'm thankful for that. Mozilla and WebKit have come out with some interesting proprietary CSS properties, and since we all know that cementing standards...
I wouldn't say that I'm addicted to checking Google Analytics but I do check my statistics often. I guess hoping for a huge burst of traffic from some unknown source. Anyway, I have multiple sites set up within my account. The way to...
Why do you have the
-s
flag in there? Looking at the--help
forcp
, that’s the option to “make symbolic links instead of copying”, and according to Stack Overflow http://stackoverflow.com/questions/1240636 , that doesn’t even work recursively (with the-R
flag). (Nor can I see why you would want to copy an entire directory recursively only for it to be populated with symlinks, especially “for the sake of backup”.) Typo?EDIT: David has since corrected the error in question.
Another great option that I somehow always forget to use is -a (archive), used like so:
It copies structure and permissions and also preserves symlinks.
Just use rsync, faster and more options. )
Good to know. But I agree with @John
I prefer to use rsync for this purpose