copying files of cert
Peace,
Here is a quick question which I will really appreciate it. I want to copy files and folders (keeping the same hierarchy) from a certain machine to another. The point is I do not want to copy files of certain extension, like say foo.exe (and it is one extension that I do not need) from the original machine to the new one. How may one do this? Faizlo PS. I could not edit the title of the post, sorry for the typo. I wanted to say "copying files of certain type(s)!" |
Code:
ls -1 | grep -v "^.exe$" | xargs -n 1 -iHERE cp -R HERE <destination |
Peace,
Thank you darkangel29, I have some questions: What is "HERE"? When I tried ls -1 alone, it did not give me a recursive listing of all subdirectories. I read the man pages and I found -R flag, should I use this? faizlo PS. I used the following command: ls -1 | grep -v "^.exe$\" | xargs -n 1 -i cp -R < /my_destination/faizlo/tutorials/ (I removed HERE) I was given the error: Illegal variable name. |
Or you could do it with rsync
rsync --exclude '*.exe' /source/dir/* /dest/dir/ |
Hi billymayday,
rsync did not go through all the subfolders. Is there a way to do this (keeping the same hierarchy as in the original source directory? faizlo |
Sorry -I normally use another option that implies recursion
Try rsync -r --exclude '*.exe' /source/dir/ /dest/dir/ Note the trailing /'s |
All times are GMT -5. The time now is 07:31 AM. |