LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-27-2007, 06:28 AM   #1
shipon_97
Member
 
Registered: Oct 2005
Location: Bangladesh
Posts: 504

Rep: Reputation: 31
copy from list command in Linux RHEL4.0


bash-3.00# ls -lrt | more
total 37778144
-rw-r----- 1 oracle dba 1047552 Sep 26 10:41 arch00000096710001
-rw-r----- 1 oracle dba 1048064 Sep 26 11:12 arch00000096720001
-rw-r----- 1 oracle dba 1047552 Sep 26 11:49 arch00000096730001
-rw-r----- 1 oracle dba 1048064 Sep 26 12:41 arch00000096740001
-rw-r----- 1 oracle dba 1048064 Sep 26 13:19 arch00000096750001
-rw-r----- 1 oracle dba 1047552 Sep 26 14:09 arch00000096760001
-rw-r----- 1 oracle dba 1048064 Sep 26 15:16 arch00000096770001
-rw-r----- 1 oracle dba 1048064 Sep 26 15:55 arch00000096780001
-rw-r----- 1 oracle dba 1048064 Sep 26 16:02 arch00000096790001
-rw-r----- 1 oracle dba 1047552 Sep 26 16:30 arch00000096800001
-rw-r----- 1 oracle dba 68608 Sep 27 09:10 arch00000096810001
-rw-r----- 1 oracle dba 1048064 Sep 27 10:00 arch00000096820001
-rw-r----- 1 oracle dba 1048064 Sep 27 11:16 arch00000097070001
-rw-r----- 1 oracle dba 1046528 Sep 27 11:16 arch00000097060001
-rw-r----- 1 oracle dba 70656 Sep 27 11:21 arch00000097080001
-rw-r----- 1 oracle dba 1048064 Sep 27 11:32 arch00000097090001
-rw-r----- 1 oracle dba 1048064 Sep 27 11:32 arch00000097100001
-rw-r----- 1 oracle dba 4319744 Sep 27 11:47 arch00000097110001
-rw-r----- 1 oracle dba 1048064 Sep 27 11:48 arch00000097120001
-rw-r----- 1 oracle dba 1048064 Sep 27 11:48 arch00000097130001
-rw-r----- 1 oracle dba 10485248 Sep 27 12:05 arch00000097140001
-rw-r----- 1 oracle dba 1048064 Sep 27 12:13 arch00000097150001
-rw-r----- 1 oracle dba 1047552 Sep 27 12:14 arch00000097160001
-rw-r----- 1 oracle dba 10485248 Sep 27 13:40 arch00000097170001
-rw-r----- 1 oracle dba 1047040 Sep 27 13:41 arch00000097180001
-rw-r----- 1 oracle dba 1047552 Sep 27 13:41 arch00000097190001
-rw-r----- 1 oracle dba 10484736 Sep 27 14:16 arch00000097200001
-rw-r----- 1 oracle dba 1048064 Sep 27 15:33 arch00000097210001
-rw-r----- 1 oracle dba 1048064 Sep 27 15:33 arch00000097220001
-rw-r----- 1 oracle dba 10485248 Sep 27 15:33 arch00000097230001
-rw-r----- 1 oracle dba 1048064 Sep 27 15:33 arch00000097240001
-rw-r----- 1 oracle dba 1048064 Sep 27 15:33 arch00000097250001
-rw-r----- 1 oracle dba 10485248 Sep 27 15:33 arch00000097260001
-rw-r----- 1 oracle dba 1048064 Sep 27 15:33 arch00000097270001
-rw-r----- 1 oracle dba 1048064 Sep 27 15:33 arch00000097280001
-rw-r----- 1 oracle dba 10485248 Sep 27 15:33 arch00000097290001
-rw-r----- 1 oracle dba 1048064 Sep 27 15:34 arch00000097300001
-rw-r----- 1 oracle dba 1047040 Sep 27 15:34 arch00000097310001
-rw-r----- 1 oracle dba 10481152 Sep 27 15:34 arch00000097320001
-rw-r----- 1 oracle dba 1048064 Sep 27 15:34 arch00000097330001.



Dear friends ,

I have same questions about "copy" command in Linux, plz give me answers

1) I want to copy all the files from to another folder like :

cp arch00000096710001 to arch00000097330001 "to another folder" , not mentioning all files name

2) I want to copy all the files date-wise , Like following way :

cp Sep 27 12:14 to Sep 27 15:34 "to another folder"

3) I want to copy using llist file command Like ,

cp "ls -lrt"

Are these possible to do ? plz help .. ...
 
Old 11-27-2007, 09:27 AM   #2
indeliblestamp
Member
 
Registered: Feb 2006
Distribution: Fedora
Posts: 341
Blog Entries: 3

Rep: Reputation: 40
1) I want to copy all the files from to another folder like :

cp arch00000096710001 to arch00000097330001 "to another folder" , not mentioning all files name

Use something like this:
Code:
 cp * /home/username/newfolder
This will copy all files in the current directory to a directory called /home/username/newfolder.

2) I want to copy all the files date-wise , Like following way :

cp Sep 27 12:14 to Sep 27 15:34 "to another folder"

You'll have to do it relative to today's date. Here's one example:
Code:
find . -ctime -60 ! -ctime -30 -exec cp {} /home/username/newfolder \;
This should copy all files created in the last 60 days, but not ones created in the last 30 days (i.e. files created between 30 and 60 days ago).

3) I want to copy using llist file command Like ,

cp "ls -lrt"

Not exactly possible, since the first few columns of ls -lrt's output will confuse the cp command. You can pipe the output of commands like ls to other commands like cp, but in such cases its not necessary, since cp * or any other wildcards will work the same way they work for ls.
 
Old 11-27-2007, 09:29 AM   #3
indeliblestamp
Member
 
Registered: Feb 2006
Distribution: Fedora
Posts: 341
Blog Entries: 3

Rep: Reputation: 40
By the way, a good way to learn how to use a command is to read the man pages. Type man cp or man find to see the manuals for those two commands. And don't worry if it doesn't make sense in the first read
 
Old 11-27-2007, 10:00 PM   #4
shipon_97
Member
 
Registered: Oct 2005
Location: Bangladesh
Posts: 504

Original Poster
Rep: Reputation: 31
ls command to see date-wise files

Dear friend ,

Thx for ur reply ...
I need another information , i want to "ls" file as date-wise .

i.e.,

I want to see the files from sep23 to sep 26 among all the files in the list .
In this regard how can i make "ls" command to see particular files .
 
Old 11-27-2007, 11:47 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,362

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
If youn really want a date range, use the find soln from arungoodboy and substitute ls or whatever for the cp cmd.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a single command to list all hardware installed (command line)? davee Linux - Hardware 6 02-28-2009 07:19 PM
the cp (copy) command in linux unkie888 Linux - Newbie 7 01-10-2009 03:18 PM
? A list of every existing (binary) Linux system command? GrapefruiTgirl Linux - General 3 05-25-2007 07:54 PM
Command to run another command against a list of files psweetma Linux - General 3 11-09-2005 05:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration