Solved

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

Posted on 2004-09-03
8
614 Views
Last Modified: 2010-04-20
Hi,

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....

Cheers

G
0
Comment
Question by:GlenmoranUK
8 Comments
 
LVL 45

Expert Comment

by:sunnycoder
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

Sunnycoder
0
 
LVL 11

Accepted Solution

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


that should be enough
0
 
LVL 45

Assisted Solution

by:sunnycoder
sunnycoder earned 150 total points
ID: 11970689
GlenmoranUK,

-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
Sunnycoder
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 19

Expert Comment

by:ramazanyich
ID: 11970691
it should be  cp *.pl /usr/cdglobal/codex
0
 
LVL 38

Expert Comment

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

cd dir1

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



0
 

Expert Comment

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

Expert Comment

by:garry_m
ID: 11971315
sorry, should have been:

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

Author Comment

by:GlenmoranUK
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..)

G
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
su - oracle could not open session 6 95
awk sed 8 63
ftp to port 21 4 53
php56-php-mcrypt for rhel7 php56 1 43
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
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…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

791 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