FG
💻 Software

Copy directory contents using 'cp' command

Fresh5 days ago
Mar 15, 2026105724 views
Confidence Score0%
0%

Problem

How do you copy all the contents of one directory into another? For example: The problem with the above is that the globing pattern '*' matches the hidden directories '.' and '..' and you end up with a directory 'olduser' inside 'newuser', as well as the contents. You could also do something like t…

Error Output

$ cd /home/newuser
$ cp -a /backup/olduser/* .

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Copy directory contents using 'cp' command

Low Risk

Try:

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment