Results 1 to 5 of 5

Thread: Command cp selective

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

  2. #2
    Join Date
    Apr 2008
    Posts
    2,005

    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.

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

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    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.

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

Similar Threads

  1. Nokia N8 plays only selective MKV files
    By Roxie in forum Portable Devices
    Replies: 6
    Last Post: 14-02-2012, 05:33 PM
  2. Replies: 3
    Last Post: 18-10-2011, 08:20 PM
  3. Selective Wi-Fi connection on Toshiba NB205
    By Alfiee in forum Portable Devices
    Replies: 6
    Last Post: 03-05-2011, 10:11 AM
  4. How to disable Selective Call Blocking in Reliance
    By Telamon in forum India BroadBand
    Replies: 2
    Last Post: 11-11-2010, 03:26 PM
  5. Replies: 2
    Last Post: 18-08-2007, 01:04 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,631,797.82791 seconds with 17 queries