-
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.
-
Re: Command cp selective
Hi,
You can use this command to display the long options.
With the display of long options you can see the type of file. For more options of ls you can refer to
Other wise you can use the command, it is simple
For more options of find you can refer to
If any more problems then do post back.
-
Re: Command cp selective
Hi
Thanks for responding, I used the command that you have mentioned.
They work perfectly, but these are only for files and directories I also want to copy what is the solution for that? Any advice.
-
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.
-
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.
Page generated in 1,711,712,321.27434 seconds with 10 queries