LinuxQuestions.org
Review your favorite Linux distribution.
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
 
LinkBack Search this Thread
Old 03-18-2008, 10:13 PM   #1
andreas_skw
Member
 
Registered: Jan 2008
Location: Indonesia, tanah air beta
Distribution: Knoppix v5
Posts: 97

Rep: Reputation: 15
Copy a hundred...


What is the command for copying lot of files? Said in one folder, i want to copy 10 files among 100 files. What is the command? It not efficient if i used cp files.ext one by one isn'it?. Helppp meee pleaseee
 
Old 03-18-2008, 10:18 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Squeeze
Posts: 5,697

Rep: Reputation: 286Reputation: 286Reputation: 286
How do you distinguish which 10 files of the 100 are to be copied? If that isn't a common feature to focus on, then you have no choice but to cp one by one.
 
Old 03-18-2008, 10:20 PM   #3
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,051

Rep: Reputation: 953Reputation: 953Reputation: 953Reputation: 953Reputation: 953Reputation: 953Reputation: 953Reputation: 953
There's a lot of stuff. How about reading help bash?
 
Old 03-18-2008, 10:57 PM   #4
Ghodmode
LQ Newbie
 
Registered: Feb 2007
Location: New Zealand
Distribution: Kubuntu
Posts: 11

Rep: Reputation: 0
There are so many ways to do it. As bigrigdriver suggested, it depends on how you distinguish the files you want to copy from the ones you don't.

If it's only 10 files out of 100, you might be better off using a file manager with a GUI such as Nautilus on Gnome or Konqueror/Dolphin on KDE.

If you want to use the command line, then suppose, for example, that you want to copy all of the files that were modified more than one day ago ...

Code:
find -mtime +1 -exec -print cp {} \;
I'd break down that command for you, but then you wouldn't have any reason to type man find

--
Ghodmode
 
Old 03-18-2008, 11:01 PM   #5
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
How are the 10 files out of 100 distinguished from the others?

Sometimes you can use wildcards to select the files you want.
example: cp *.jpg pictures/
example: cp spooky{0..9}.txt chapters/

If you want to copy all files in the current directory that are less than 30 minutes old:
example: find ./ -cmin -30 -exec cp '{}' newfiles/ \;

If they are arbitrary files, include them in the argument. The last argument is the destination and needs to be a directory:
copy file1 file2 file3 file4 file5 destdir/
 
  


Reply

Tags
copying


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Nine Hundred Swedish Pharmacies Switch to Linux LXer Syndicated Linux News 0 09-19-2007 06:10 PM
LXer: LinuxQuestions.org Reaches Two Million Posts and Two Hundred Thousand Members LXer Syndicated Linux News 0 12-21-2005 06:31 AM
automatised changing of tone curve / light in several hundred pictures ungua Linux - Software 3 02-01-2005 01:56 PM
I know you have heard this a hundred times but... blmartin777 Debian 9 04-25-2004 10:05 PM
boot error after using Copy Commander to copy debian system onto larger new drive Interceptor Linux - Hardware 7 05-04-2003 12:40 PM


All times are GMT -5. The time now is 01:30 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration