Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Command cp selective

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 04-12-2009
Member
 
Join Date: Nov 2009
Posts: 446
Command cp selective
  

Hello,
Within a year of introduction to Linux, I have a directory of all files and sub directories, I would copy the files and only files in another location. I see that the cp command to make this, work well however, the manual does not indicate an option to choose the type of argument (file or directory). What command should I use so that the number of files to move are very large. Can i use the cp command selectively. I thank you in advance. Any advice or suggestion will be appreciated.

Reply With Quote
  #2  
Old 04-12-2009
Member
 
Join Date: Apr 2008
Posts: 2,000
Re: Command cp selective

Hi,
You can use this command to display the long options.
Code:
"ls-l"
With the display of long options you can see the type of file. For more options of ls you can refer to
Code:
man ls
Other wise you can use the command, it is simple
Code:
"find name"
For more options of find you can refer to
Code:
man find
If any more problems then do post back.
Reply With Quote
  #3  
Old 04-12-2009
Member
 
Join Date: Nov 2009
Posts: 446
Re: Command cp selective

Hi
Thanks for responding, I used the command that you have mentioned.
Code:
"ls-l"
"find name"
They work perfectly, but these are only for files and directories I also want to copy what is the solution for that? Any advice.
Reply With Quote
  #4  
Old 04-12-2009
Member
 
Join Date: Apr 2008
Posts: 2,000
Re: Command cp selective

Hello
You can just issue this command in the terminal,
Code:
find / path-type f-exec cp () / destination \;
That is it, the have found the files and at the same time you have also copied them to the destination.
Reply With Quote
  #5  
Old 04-12-2009
Member
 
Join Date: Nov 2009
Posts: 446
Re: Command cp selective

Hi
The command you posted worked fine. I have another small question for you. More generally, if we want to invert the selection, type copy only files that does not start by the letter "c" or not the extension, etc. what should be changed in the following command line (It just an example)?
Code:
$ Find. -name "c *"-exec cp () / destination \;
Any advice on this.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Command cp selective"
Thread Thread Starter Forum Replies Last Post
Nokia N8 plays only selective MKV files Roxie Portable Devices 6 14-02-2012 04:33 PM
Selective opening in Seagate GoFlex Satellite’s causes app to crash silvery Hardware Peripherals 3 18-10-2011 08:20 PM
Selective Wi-Fi connection on Toshiba NB205 Alfiee Portable Devices 6 03-05-2011 10:11 AM
How to disable Selective Call Blocking in Reliance Telamon India BroadBand 2 11-11-2010 02:26 PM
What's the difference between Safe Mode and Selective Startup Kishan Windows XP Support 2 18-08-2007 01:04 PM


All times are GMT +5.5. The time now is 11:08 AM.