2

Assuming this tree (top-X & tX-sub-X are folders, and all sub-folder containing a .csv and various other file extensions.)

Base
├── top-1
│   ├── t1_sub-1 
│   ├── t1_sub-2 
│   └── t1_sub-3 
│
└── top-2
    ├── t2_sub-1
    ├── t2_sub-2
    └── t2_sub-3

and all sub-folder containing a .csv and various other file extensions.

can I symlink all .csv in base to another tree amd have this:

Symlinked_base
├── top-1 #directories aren't symlink
│   ├── t1_sub-1 #contains only .csv symlink
│   ├── t1_sub-2 
│   └── t1_sub-3 
│
└── top-2
    ├── t2_sub-1
    ├── t2_sub-2
    └── t2_sub-3

I can't test it now but would:

sudo find . -name "*.csv" -exec cp -Rs '{}' /path/to/Symlinked_base/

if -R is unsupported, would the following work? :

 sudo find . -name "*.csv" -exec cp -parents -s '{}' /path/to/Symlinked_base/
  • Your question is not clear. What is t1_sub-1 in Base and Symlinked_base ? Is that a directory or a file? – Valentin Bajrami Jun 1 '18 at 12:08
  • @val0x00ff t1-subs & base are folders will add details – Ebya Jun 1 '18 at 13:20
1

Stow is a package to maintain symlink trees. You can use the --no-folding option to create directories at the destination instead of linking the directories themselves - that should get you what you want.

https://www.gnu.org/software/stow/manual/stow.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.