copying/moving inside the terminal

closed account (i8bjz8AR)
So I tried looking on google and still couldn't figure out what I wanted.
I have two different directories, truck and car.

Car contains several sub directories inside it, like a headlight.hpp file, a battery.cpp file, and a windshield.hpp file. These all have code inside them.

Truck contains the exact same sub directories(headlight.hpp, battery.cpp, windshield.hpp), except they are all empty(no code).

I'm trying to, one at a time, copy the contents from Car into Truck, with the content still remaining in Car once I copy it to Truck.

How do i do this? I feel like it's simple but for some reason just can't hack it tonight and this would also be nice to know for productivity reasons. Any help appreciated!
You could do:
cp -R car/. truck/

This will copy all content of car and put it in truck. If a file already exist in truck it will be overwritten. If truck contains other files that are not present in car they will remain unmodified. If truck doesn't exist it will be created.
rsync -av car/ truck/

Copies content of car into truck recursively, including timestamps and permissions, and does not copy files that already exist and are identical.

A very versatile command. (Some options are a bit tricky.)

You can do:
man man
man cp
man rsync

to read documentation.
Topic archived. No new replies allowed.