Copy files from different directories
The normal
Code:
cp -r Starting_dir Ending_dir Instead, I want to copy (for example) all the python files (ending with *.py), scattered all over my home (in different subdirs) into a unique directory, by means of a command like this: Code:
cpx ~/*.py collecting_dir |
cp ~/*.py /some/destination/
you can still use -R for recursive... |
You could try
find ~ -name "*.py" -exec cp "{}" <destination-dir>/ \; In a script, the variable $HOME is usually used instead of '~'. As I understand your question, you want all of the scripts copied into the same target directory, without any of the subdirectories copied as well. |
Hi ,
thank for your replies. jschiwal is correct . I have found the same indications (after posting ... RTM !) in the O'Reilly's "Unix Power Tools" about the use of find + -exec command (pag. 291 of the 2nd Edition). About the secesh's reply, I think that he wanted correct my "cpx"... I only used cpx has a placeholder of something else: the command with cp does not work as I am looking for. |
All times are GMT -5. The time now is 03:06 PM. |