Quick Answer: How Do I Copy a Folder Except One in Linux?
Contents

We can also use cp command to copy folders from one location to another excluding specific directories. Go your source directory i.e ostechnix in our case. The above command will copy all contents of the current folder ostechnix except the sub-directory dir2 and saves them to /home/sk/backup/ directory.

How do I copy all files except one in Linux?

The best and simple way is using find . Go to the source directory. Then use the following commands. This copies all files except “*.

How copy and exclude files in Linux?

Type cp * , hit Ctrl X * and just see what happens. This assumes the target directory structure being the same as the source’s. It’s relative to the source directory. This will exclude the directory source/.

David Miller

David Miller

Executive Financial & Market Analyst

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.

Share this article
Twitter Facebook Pinterest