Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Help for Copying directory structure recursively

    I have a directory that contain some .csv files and also some sub directories those contained csv files. I need to copy only my folder structure with csv’s inside child directory without copying perant directory csv’s
    (only need to exclude parent directory csv files)
    I tried lot with rsync and cp but couldn’t make it please help.

    ---Sorry for bad explanation.

  2. #2
    Try giving us a listing of the directory and file structure and what you wish to copy and what you wish to exclude.

    For example, I'll pretend you have this:

    Let's say in the above example, you want to copy dir1/dir2/new*.csv, but not copy the files in dir1/file*.csv, nor the text files in dir1/dir2, and you wanted to retain the full directory structure (dir1/dir2) when copying to the new location (let's say /newdir). You could use a combination of find and install to do it, e.g.:

    find dir1/ -type f -name '*.csv' -exec install -Dv {} ./newdir/{} \;
    Again, this is probably not exactly what you are looking for, but share more details and we'll try to help you get there.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts