FG
💻 Software

How to copy with cp to include hidden files and hidden directories and their contents?

Fresh5 days ago
Mar 15, 2026745749 views
Confidence Score1%
1%

Problem

How can I make copy absolutely all of the files and directories in a directory Requirements: Include hidden files and hidden directories. Be one single command with an flag to include the above. Not need to rely on pattern matching at all. My ugly, but working, hack is: How can I do this all in one command without the pattern matching? What flag do I need to use?

Error Output

cp -r /etc/skel/* /home/user
cp -r /etc/skel/.[^.]* /home/user

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How to copy with cp to include hidden files and hidden directories and their contents?

Low Risk

Lets say you created the new folder (or are going to create one) and want to copy the files to it after the folder is created This will copy all files/folder recursively from in to the already existing folder created on the first line.

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment