how to cp filestructure for specific file pattern
hi,
think that's a simple one: how can i copy a a filestructure recursively for files matching a specific pattern like *.java -> copy all javafiles from that dir + subdirs and create the same dirstructure at the destination...d'you know what i mean? thanx mizuki |
I don't know of a way to do it without writing a script but you could copy the folder then remove everything else.
|
hmm
if i would copy the whole structure i would overwrite also files that are not *.java. that's what i want to avoid. i want to copy only the java files recursively from one structure to another. both file structures looking the same. i just want to "update" the java files in that structure. any idea?
|
Ok folder1 has the .java files you want and folder3 is where you want the files to end up.
1) copy folder1 to folder2 2) remove all non .java files 3) move folder2s contents to folder3 |
find . -name *java | cpio -pvd /destination/directory
you could probably rearrange the command to allow you to copy from somewhere else than the current directory, but that will then use absolute paths, and so create leading directories all the way back to /, not just the current directory: Code:
chris@trevor mail $ find . |
thanx
sounds good...
i think that will work. thank you. |
All times are GMT -5. The time now is 05:38 AM. |