|
|
|
|
google site
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|||
|
cp without maintaining the soucre directory tree hierarchy
Hi guys.
I'm willing to copy a specific file system hierarchy, but I would not like to maintain the directory tree organization. For example: Let's say /a/b/c is the fs I'm wanting to copy to my destination, and that c is a directory with 30 files, 10 on /a/b/c , 10 on a/b/c/c1 and 10 on a/b/c/c2 , I'd like to have all files from inside /a/b/c into my destination, but all of them scattered within a/b/c/ only , not obeying to the source directory tree (I wouldn't, hence, have the directories c1 nor c2, but I would have 30 files) more clearly, how do I copy a multi-directory structure and have all the resulting files in a single directory destination, with all the files ending in one directory, alone ? Thanks in advance, Abrahao. |
| Sponsored Links | ||
|
|
|
|||
|
I believe this is what you're looking for
find /a/b/c -depth -type f -print -exec cp {} /a/b/c/ \; If you want to empty the sub-directories, use "mv" instead of "cp" I would recommend copying the files to a directory NOT in the search path. Worst case scenerio, the copy/move will fail because the source and target names are identical. |
|
|||
|
it seems issuing only
find <file system from where I want the copy to begin> -name <pattern> -exec cp {} <destination_dir> \; worked fine for this purpose. Thank you all, anyway! |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Protecting the directory tree | rooneyl | UNIX for Dummies Questions & Answers | 2 | 02-17-2008 05:59 PM |
| directory tree | ravi raj kumar | Shell Programming and Scripting | 3 | 01-24-2008 01:08 PM |
| Need to search and replace in multiple files in directory hierarchy | umen | Shell Programming and Scripting | 3 | 12-24-2007 04:56 AM |
| directory as tree | anything2 | Programming | 2 | 03-01-2007 09:38 AM |
| Space Used by Directory Tree | johnk99 | Filesystems, Disks and Memory | 1 | 07-22-2002 01:30 PM |