Copy Command - Simple, but Urgent!!!  EASY Points!

Posted on 2004-09-03
Last Modified: 2010-04-20

I need to know how to copy all files from one folder to another folder.

The files I need to copy are all *.pl files and I need to copy them from folder 1 to folder 2.  I have tried this command but it did not work:

cp *.pl /usr/cdglobal/codex/*.pl

Can anyone help....


Question by:GlenmoranUK
LVL 45

Expert Comment

ID: 11970682
Hi GlenmoranUK,

> I need to know how to copy all files from one folder to another folder.

cp -R source_folder dest_folder

LVL 11

Accepted Solution

avizit earned 350 total points
ID: 11970687
cp *.pl /usr/cdglobal/codex/

that should be enough
LVL 45

Assisted Solution

sunnycoder earned 150 total points
ID: 11970689

-R option is recursive ... it wil copy all files and folder

if you want only the pl files in one flder copied,

cp source_folder/*.pl dest_folder
LVL 19

Expert Comment

ID: 11970691
it should be  cp *.pl /usr/cdglobal/codex
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

LVL 38

Expert Comment

ID: 11970923
If you what to keep the original file permissions use tar:

cd dir1

tar cf - . | (cd /path-to/dir2; tar xvf -)


Expert Comment

ID: 11971309
cd /sourcefolder
for x in *; do cp $x /targetfolder; done;

Expert Comment

ID: 11971315
sorry, should have been:

for x in *.pl; do cp $x /targetfolder; done;

Author Comment

ID: 11971413
Thanks guys,

For some reason its taken this long for the e-mail from Experts Exchange to reach me with the solutions.

Split points between avizit and sunnycoder.  Avizit game the command in the form I needed and sunny for the additional explination.

Thanks guys..

(We have had a problem with our server and our consultant is on holiday.  For some reason it crashed last night during its night jobs.  People could log in but had no access to any programs.  I found that the night job copies the user profiles (the .pl files) to a temp storage to prevent users using the programs then when the night jobs are completed it copies them back.  It never got the chance to copy them back and so they were all in this temp folder.  Hence needing the command to copy them all back..)


Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension ( This reminded me of questions tha…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now