[opensuse] creating symlinks for all files in directory recursively in specified directory
Hello: I tried to summarize in the subject what I'd like to do: I want to create symlinks for all the files within a folder recursively with the symlinks to be in one directory. For example: Source dir: source/dir1/a/file1 source/dir1/a/file2 source/dir1/a/file3 source/dir1/b/file4 source/dir1/b/file5 source/dir1/b/file6 source/file7 The target should be: target/file1 -> source/dir1/a/file1 target/file2 -> source/dir1/a/file2 target/file3 -> source/dir1/a/file3 target/file4 -> source/dir1/b/file4 target/file5 -> source/dir1/b/file5 target/file6 -> source/dir1/b/file6 target/file7 -> source/file7 How could do it? Thanks, Istvan -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Op woensdag 12 februari 2020 21:38:13 CET schreef Istvan Gabor:
Hello:
I tried to summarize in the subject what I'd like to do:
I want to create symlinks for all the files within a folder recursively with the symlinks to be in one directory. For example:
Source dir:
source/dir1/a/file1 source/dir1/a/file2 source/dir1/a/file3 source/dir1/b/file4 source/dir1/b/file5 source/dir1/b/file6 source/file7
The target should be:
target/file1 -> source/dir1/a/file1 target/file2 -> source/dir1/a/file2 target/file3 -> source/dir1/a/file3 target/file4 -> source/dir1/b/file4 target/file5 -> source/dir1/b/file5 target/file6 -> source/dir1/b/file6 target/file7 -> source/file7
How could do it?
Thanks,
Istvan
cd /path/to/target ln -s /path/to/source/dir1/* . should work -- Gertjan Lettink a.k.a. Knurpht openSUSE Forums Team -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Wed, 12 Feb 2020 21:42:42 +0100, Knurpht-openSUSE wrote:
Op woensdag 12 februari 2020 21:38:13 CET schreef Istvan Gabor:
Hello:
I tried to summarize in the subject what I'd like to do:
I want to create symlinks for all the files within a folder recursively with the symlinks to be in one directory. For example:
Source dir:
source/dir1/a/file1 source/dir1/a/file2 source/dir1/a/file3 source/dir1/b/file4 source/dir1/b/file5 source/dir1/b/file6 source/file7
The target should be:
target/file1 -> source/dir1/a/file1 target/file2 -> source/dir1/a/file2 target/file3 -> source/dir1/a/file3 target/file4 -> source/dir1/b/file4 target/file5 -> source/dir1/b/file5 target/file6 -> source/dir1/b/file6 target/file7 -> source/file7
How could do it?
Thanks,
Istvan
cd /path/to/target ln -s /path/to/source/dir1/* .
should work
Thanks! Unfortunately this is not what I want. This command mirrors the directory tree, it symlinks the subdirectories, and not the files within them. For example for source/dir1/a/file1 it creates target/dir -> source/dir1 and not target/file1 -> source/dir1/a/file1 But I did not know that ln works like this, so I learned something. Thanks again, Istvan -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 12/02/2020 21.38, Istvan Gabor wrote:
Hello:
I tried to summarize in the subject what I'd like to do:
I want to create symlinks for all the files within a folder recursively with the symlinks to be in one directory. For example:
I did the same thing with help from here :-) But I'm unable to locate it now :-( -- Cheers / Saludos, Carlos E. R. (from openSUSE 15.1 (Legolas))
On 12/02/2020 21.50, Carlos E. R. wrote:
On 12/02/2020 21.38, Istvan Gabor wrote:
Hello:
I tried to summarize in the subject what I'd like to do:
I want to create symlinks for all the files within a folder recursively with the symlinks to be in one directory. For example:
I did the same thing with help from here :-)
But I'm unable to locate it now :-(
Found it. It was where I was looking, but the name was not what I remembered. You will have to edit. Let's see if I can open and copy paste from a remote computer... - yep, I could. Nice :-) Oops, the comments are in Spanish. And I think there is another version somewhere, I think using sed with the help from Andrei. Or my memory is playing me tricks. +++....................... #!/bin/bash #Duplica un arbol de directorios en otro, con soflinks. Usa recursividad. Adaptado de "duplicar" #Existen herramientas que lo hacen directamente, pero mi objectivo es borrar los enlaces muertos también. # El "~" no se expande. DESTINO="/home/cer/Fusion/Videos" ORIGENREL="3_MyBook_VideosTst/" ORIGENREL="3_MyBook_Videos/" ORIGEN="$DESTINO/$ORIGENREL" TMPFILE=$DESTINO/fusiondup.lst LOGDUP=$DESTINO/fusiondup_regfiles.lst # Creo que habrá que borrar el enlace "~/Fusion/Videos/3_MyBook_Videos", o se buscaría a sí mismo. function CreateSLink() { # target name # se crea enlace 1 -> 2 sólo si 2 no existe en forma alguna. #echo "-1->" "$1" | grep -i 06_completa #echo "-2->" "$2" | grep -i 06_completa if [ ! -e "$2" ]; then # Si es un enlace, lo borramos para volver a crearlo. Al menos mientras estamos de pruebas. if [ -L "$2" ]; then rm "$2" fi ln -s "$1" "$2" #> /dev/null #echo "$1" "-->" "$2" else # Añadir test que el destino no exista como fichero regular, y en ese caso reportarlo en un log. if [ -f "$2" -a ! -L "$2" ]; then echo "$2" >> $LOGDUP ls -l "$2" fi fi } function CreateDir() { if ! test -d "$1" ; then mkdir "$1" # > /dev/null #echo "Mk: ""$1" fi } function UnNivel() # Recursiva!! { local IFILE="$1" local OFILE="$2" local OOFILE=`echo "$OFILE" | cut -b 3-` local FILE_L1="A" local declare NAMEARRAY NIVEL=`expr $NIVEL + 1` PREFIJO="" for((i=1;i<$NIVEL;i++)) do PREFIJO="../$PREFIJO" done #echo IFILE: $IFILE #echo OFILE: $OFILE #echo OOFILE: $OOFILE find "$IFILE" -maxdepth 1 -printf "%f\n"> $TMPFILE readarray -t NAMEARRAY < $TMPFILE rm $TMPFILE #echo "Nivel $NIVEL - $PREFIJO - $IFILE" for FILE_L1 in "${NAMEARRAY[@]}" do #echo "$FILE_L1" | grep -i ARMA # Es un archivo if test -f "$IFILE"/"$FILE_L1" ; then # target name #Absolute CreateSLink "$IFILE/$FILE_L1" "$OFILE/$FILE_L1" # enlazar fichero #Relative #RELATIVE=`realpath --relative-to="$ORIGENREL" "$IFILE/$FILE_L1"` #echo "-->" "$IFILE/$FILE_L1" "-->" "$RELATIVE" #CreateSLink "$PREFIJO""$ORIGENREL""$OOFILE"/"$FILE_L1" "$OFILE"/"$FILE_L1" # enlazar fichero #CreateSLink "$ORIGENREL""$RELATIVE" "$OFILE"/"$FILE_L1" # enlazar fichero #../../3_MyBook_VideosTst/./Big Poof/Season 2/episode uno.mpeg --> ./Big Poof/Season 2/episode uno.mpeg # $OFILE empieza por './', a ver si se puede quitar. Pero sólo aquí. Hecho. #Problema. Las peliculas en raiz deben empezar por ./, no ../ # tambien pasa en Raiz de Big Bang. #Problema dos: se pierden los dobles espacios en los nombres. Corregido. Era en la creación de OOFILE, quizás otros. Todas las variables entre comillas individuales. # /Arma letal VOS / --> # /Arma letal VOS / fi # Es un directorio if test -d "$IFILE"/"$FILE_L1" ; then CreateDir "$OFILE"/"$FILE_L1" # crear directorio UnNivel "$IFILE"/"$FILE_L1" "$OFILE"/"$FILE_L1" # Recorrer el siguiente nivel fi done NIVEL=`expr $NIVEL - 1` }
$LOGDUP rm $LOGDUP
NIVEL=0 cd "$DESTINO" #UnNivel "$ORIGEN" "$DESTINO" UnNivel "$ORIGEN" "." echo "Done." if [ -f $LOGDUP ]; then echo "See $LOGDUP for list of non links found on target" fi .......................++- -- Cheers / Saludos, Carlos E. R. (from openSUSE 15.1 (Legolas))
On 2020-02-12 04:11 PM, Carlos E. R. wrote:
I did the same thing with help from here:-)
But I'm unable to locate it now:-(
Found it. It was where I was looking, but the name was not what I remembered.
Maybe you should make a symlink to it. ;-) -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 12/02/2020 22.19, James Knott wrote:
On 2020-02-12 04:11 PM, Carlos E. R. wrote:
I did the same thing with help from here:-)
But I'm unable to locate it now:-(
Found it. It was where I was looking, but the name was not what I remembered.
Maybe you should make a symlink to it. ;-)
LOL:-) I have a script to search for scripts. Now where is it...? -- Cheers / Saludos, Carlos E. R. (from openSUSE 15.1 (Legolas))
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 12/02/2020 22.31, Carlos E. R. wrote: | On 12/02/2020 22.19, James Knott wrote: |> On 2020-02-12 04:11 PM, Carlos E. R. wrote: |>>> I did the same thing with help from here:-) |>>> |>>> But I'm unable to locate it now:-( |>>> |>> Found it. It was where I was looking, but the name was not what |>> I remembered. |> |> Maybe you should make a symlink to it. ;-) | | LOL:-) | | I have a script to search for scripts. Now where is it...? Well, I used that script to find scripts, which found the 11 matching scripts in 128 minutes, searching the entire machine. Still not the one I was thinking of... - -- Cheers / Saludos, Carlos E. R. (from 15.1 x86_64 at Telcontar) -----BEGIN PGP SIGNATURE----- Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/ iF0EARECAB0WIQQZEb51mJKK1KpcU/W1MxgcbY1H1QUCXk0TFQAKCRC1MxgcbY1H 1d1iAKCCsJdIELrlBYP7uErKNFt7gghU4QCdET8iJY9vR64MVTpnU/psz32jM5Q= =+CUL -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
be warned that there is a fair risk with duplicate file names (two files with same name and different position), also links as source jdd -- http://dodin.org -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Wed, 12 Feb 2020 21:38, Istvan Gabor <suseuser04@...> wrote:
Hello:
I tried to summarize in the subject what I'd like to do:
I want to create symlinks for all the files within a folder recursively with the symlinks to be in one directory. For example:
Source dir:
source/dir1/a/file1 source/dir1/a/file2 source/dir1/a/file3 source/dir1/b/file4 source/dir1/b/file5 source/dir1/b/file6 source/file7
The target should be:
target/file1 -> source/dir1/a/file1 target/file2 -> source/dir1/a/file2 target/file3 -> source/dir1/a/file3 target/file4 -> source/dir1/b/file4 target/file5 -> source/dir1/b/file5 target/file6 -> source/dir1/b/file6 target/file7 -> source/file7
How could do it?
Thanks,
Istvan
classic (bash-)shell script would be somesthing like this: # for each file found do link via xargs find $source_dir -type f -print0 | xargs -0 -n 1 ln -s -t $targed_dir yes, you can do it in find itself via: -exec ln ... but I'm not firm enough with the syntax to sprout it here. - Yamaban -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Wed, 12 Feb 2020 21:59:48 +0100 (CET), Yamaban wrote:
On Wed, 12 Feb 2020 21:38, Istvan Gabor <suseuser04@...> wrote:
Hello:
I tried to summarize in the subject what I'd like to do:
I want to create symlinks for all the files within a folder recursively with the symlinks to be in one directory. For example:
Source dir:
source/dir1/a/file1 source/dir1/a/file2 source/dir1/a/file3 source/dir1/b/file4 source/dir1/b/file5 source/dir1/b/file6 source/file7
The target should be:
target/file1 -> source/dir1/a/file1 target/file2 -> source/dir1/a/file2 target/file3 -> source/dir1/a/file3 target/file4 -> source/dir1/b/file4 target/file5 -> source/dir1/b/file5 target/file6 -> source/dir1/b/file6 target/file7 -> source/file7
How could do it?
Thanks,
Istvan
classic (bash-)shell script would be somesthing like this:
# for each file found do link via xargs find $source_dir -type f -print0 | xargs -0 -n 1 ln -s -t $targed_dir
yes, you can do it in find itself via: -exec ln ... but I'm not firm enough with the syntax to sprout it here.
Thanks, this does exactly what I want. How should I modify it, or how could I do it, if I wanted to apply it only to files with specific extensions, eg all .doc files? Thanks again, Istvan -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Wed, 12 Feb 2020 22:17, Istvan Gabor <suseuser04@...> wrote:
On Wed, 12 Feb 2020 21:59:48 +0100 (CET), Yamaban wrote:
On Wed, 12 Feb 2020 21:38, Istvan Gabor <suseuser04@...> wrote:
Hello:
I tried to summarize in the subject what I'd like to do:
I want to create symlinks for all the files within a folder recursively with the symlinks to be in one directory. For example:
Source dir:
source/dir1/a/file1 source/dir1/a/file2 source/dir1/a/file3 source/dir1/b/file4 source/dir1/b/file5 source/dir1/b/file6 source/file7
The target should be:
target/file1 -> source/dir1/a/file1 target/file2 -> source/dir1/a/file2 target/file3 -> source/dir1/a/file3 target/file4 -> source/dir1/b/file4 target/file5 -> source/dir1/b/file5 target/file6 -> source/dir1/b/file6 target/file7 -> source/file7
How could do it?
Thanks,
Istvan
classic (bash-)shell script would be somesthing like this:
# for each file found do link via xargs find $source_dir -type f -print0 | xargs -0 -n 1 ln -s -t $targed_dir
yes, you can do it in find itself via: -exec ln ... but I'm not firm enough with the syntax to sprout it here.
Thanks,
this does exactly what I want.
How should I modify it, or how could I do it, if I wanted to apply it only to files with specific extensions, eg all .doc files?
"man find" is the critical point here. the "-type f" e.g. is only true for regular files, for e.g. extensions the "-name '*.extension'" for case sensitive or "-iname '*.extension'" for case-insensitive is what you searchin for. for .doc and only lowercase .doc: find $source_dir -type f -name '*.doc' -print0 | xargs -0 -n 1 ln -s -t $targed_dir for .doc, .DOC, or, to be precise: .[Dd][Oo][Cc]: find $source_dir -type f -iname '*.doc' -print0 | xargs -0 -n 1 ln -s -t $targed_dir be aware of the quote-marks around the '*' to prevent shell interpretataion of the * . - Yamaban. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Wed, 12 Feb 2020 23:05:03 +0100 (CET), Yamaban wrote:
On Wed, 12 Feb 2020 22:17, Istvan Gabor <suseuser04@...> wrote:
On Wed, 12 Feb 2020 21:59:48 +0100 (CET), Yamaban wrote:
On Wed, 12 Feb 2020 21:38, Istvan Gabor <suseuser04@...> wrote:
Hello:
I tried to summarize in the subject what I'd like to do:
I want to create symlinks for all the files within a folder recursively with the symlinks to be in one directory. For example:
Source dir:
source/dir1/a/file1 source/dir1/a/file2 source/dir1/a/file3 source/dir1/b/file4 source/dir1/b/file5 source/dir1/b/file6 source/file7
The target should be:
target/file1 -> source/dir1/a/file1 target/file2 -> source/dir1/a/file2 target/file3 -> source/dir1/a/file3 target/file4 -> source/dir1/b/file4 target/file5 -> source/dir1/b/file5 target/file6 -> source/dir1/b/file6 target/file7 -> source/file7
How could do it?
Thanks,
Istvan
classic (bash-)shell script would be somesthing like this:
# for each file found do link via xargs find $source_dir -type f -print0 | xargs -0 -n 1 ln -s -t $targed_dir
yes, you can do it in find itself via: -exec ln ... but I'm not firm enough with the syntax to sprout it here.
Thanks,
this does exactly what I want.
How should I modify it, or how could I do it, if I wanted to apply it only to files with specific extensions, eg all .doc files?
"man find" is the critical point here.
the "-type f" e.g. is only true for regular files, for e.g. extensions the "-name '*.extension'" for case sensitive or "-iname '*.extension'" for case-insensitive is what you searchin for.
for .doc and only lowercase .doc: find $source_dir -type f -name '*.doc' -print0 | xargs -0 -n 1 ln -s -t $targed_dir
for .doc, .DOC, or, to be precise: .[Dd][Oo][Cc]: find $source_dir -type f -iname '*.doc' -print0 | xargs -0 -n 1 ln -s -t $targed_dir
be aware of the quote-marks around the '*' to prevent shell interpretataion of the * .
- Yamaban.
Thank you for the detailed explanation. Istvan -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
I tried to summarize in the subject what I'd like to do:
I want to create symlinks for all the files within a folder recursively with the symlinks to be in one directory. For example:
Try lndir, does exactly what you want: # rpm -qi lndir Name : lndir Version : 1.0.3 Release : lp151.2.3 Architecture: x86_64 Install Date: Fri Feb 14 14:22:07 2020 Group : Development/Tools/Building Size : 28920 License : MIT Signature : RSA/SHA256, Mon Dec 17 09:04:04 2018, Key ID b88b2fd43dbdc284 Source RPM : lndir-1.0.3-lp151.2.3.src.rpm Build Date : Mon Dec 17 09:03:56 2018 Build Host : lamb04 Relocations : (not relocatable) Packager : https://bugs.opensuse.org Vendor : openSUSE URL : http://xorg.freedesktop.org/ Summary : Utility to create a shadow directory of symbolic links to another directory tree Description : The lndir program makes a shadow copy of a directory tree, except that the shadow is not populated with real files but instead with symbolic links pointing at the real files in the original directory tree. Distribution: openSUSE Leap 15.1 -Nick -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Fri, 14 Feb 2020 14:24:16 -0600 Nick LeRoy <leroy.nick@gmail.com> wrote:
I tried to summarize in the subject what I'd like to do:
I want to create symlinks for all the files within a folder recursively with the symlinks to be in one directory. For example:
Try lndir, does exactly what you want:
# rpm -qi lndir Name : lndir Version : 1.0.3 Release : lp151.2.3 Architecture: x86_64 Install Date: Fri Feb 14 14:22:07 2020 Group : Development/Tools/Building Size : 28920 License : MIT Signature : RSA/SHA256, Mon Dec 17 09:04:04 2018, Key ID b88b2fd43dbdc284 Source RPM : lndir-1.0.3-lp151.2.3.src.rpm Build Date : Mon Dec 17 09:03:56 2018 Build Host : lamb04 Relocations : (not relocatable) Packager : https://bugs.opensuse.org Vendor : openSUSE URL : http://xorg.freedesktop.org/ Summary : Utility to create a shadow directory of symbolic links to another directory tree Description : The lndir program makes a shadow copy of a directory tree, except that the shadow is not populated with real files but instead with symbolic links pointing at the real files in the original directory tree. Distribution: openSUSE Leap 15.1
That description doesn't match the OP's requirement as I understand it, which is to flatten the directory hierarchy, not reproduce it.
-Nick
-- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 14/02/2020 21.36, Dave Howorth wrote: | On Fri, 14 Feb 2020 14:24:16 -0600 Nick LeRoy <> wrote: | That description doesn't match the OP's requirement as I | understand it, which is to flatten the directory hierarchy, not | reproduce it. You are right, flatten and rename, to avoid collisions. I didn't notice. - -- Cheers / Saludos, Carlos E. R. (from 15.1 x86_64 at Telcontar) -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQQZEb51mJKK1KpcU/W1MxgcbY1H1QUCXkex1QAKCRC1MxgcbY1H 1Ux6AJ9FM03pkl0YHbq5tl0PwMbyvIIaHwCeITygaBEddoLoaxNV8pjeeBFtvtA= =hR2e -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 15/02/2020 09.55, Carlos E. R. wrote: | On 14/02/2020 21.36, Dave Howorth wrote: | On Fri, 14 Feb 2020 | 14:24:16 -0600 Nick LeRoy <> wrote: | | | | That description doesn't match the OP's requirement as I | | understand it, which is to flatten the directory hierarchy, not | | reproduce it. | | You are right, flatten and rename, to avoid collisions. I didn't | notice. Incidentally, I just noticed a new bug in Thunderbird's enigmail: it used "|" as quote character, thus breaking things in the editor on next reply. - -- Cheers / Saludos, Carlos E. R. (from 15.1 x86_64 at Telcontar) -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQQZEb51mJKK1KpcU/W1MxgcbY1H1QUCXke3DAAKCRC1MxgcbY1H 1fypAJ47G6FJrBdnXOWWYOTF5OhQegjDRQCfQdAW3F//9dOojdE9ZwSFmpoSu7I= =kXPi -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Carlos, et al -- ...and then Carlos E. R. said... % % On 15/02/2020 09.55, Carlos E. R. wrote: % | On 14/02/2020 21.36, Dave Howorth wrote: | On Fri, 14 Feb 2020 % | 14:24:16 -0600 Nick LeRoy <> wrote: % | % | | That description doesn't match the OP's requirement as I | ... % | You are right, flatten and rename, to avoid collisions. I didn't % | notice. % % Incidentally, I just noticed a new bug in Thunderbird's enigmail: it % used "|" as quote character, thus breaking things in the editor on % next reply. What's wrong with | as a quote char? Is that because the editor is directed by a pipe, or does it just expect > only? TIA & HAND :-D -- David T-G See http://justpickone.org/davidtg/email/ See http://justpickone.org/davidtg/tofu.txt -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 15/02/2020 12.15, David T-G wrote:
Carlos, et al --
...and then Carlos E. R. said... % % On 15/02/2020 09.55, Carlos E. R. wrote: % | On 14/02/2020 21.36, Dave Howorth wrote: | On Fri, 14 Feb 2020 % | 14:24:16 -0600 Nick LeRoy <> wrote: % | % | | That description doesn't match the OP's requirement as I | ... % | You are right, flatten and rename, to avoid collisions. I didn't % | notice. % % Incidentally, I just noticed a new bug in Thunderbird's enigmail: it % used "|" as quote character, thus breaking things in the editor on % next reply.
What's wrong with | as a quote char? Is that because the editor is directed by a pipe, or does it just expect > only?
See above. I pressed "control-R" to reflow. The editor does not recognize them. -- Cheers / Saludos, Carlos E. R. (from 15.1 x86_64 at Telcontar)
Carlos -- ...and then Carlos E.R. said... % % On 15/02/2020 12.15, David T-G wrote: % > % >...and then Carlos E. R. said... % % On 15/02/2020 09.55, Carlos E. % >R. wrote: % | On 14/02/2020 21.36, Dave Howorth wrote: | On Fri, 14 % >Feb 2020 % | 14:24:16 -0600 Nick LeRoy <> wrote: % | % | | That ... % >it % used "|" as quote character, thus breaking things in the editor % >on % next reply. % > % >What's wrong with | as a quote char? Is that because the editor % >is directed by a pipe, or does it just expect > only? % % See above. I pressed "control-R" to reflow. The editor does not % recognize them. Ah; gotcha. Thanks. Yes, it needs configurability. But, then, reflowing is evil in the first place ;-) HANW :-D -- David T-G See http://justpickone.org/davidtg/email/ See http://justpickone.org/davidtg/tofu.txt -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 15/02/2020 12.24, David T-G wrote:
Carlos --
...and then Carlos E.R. said... % % On 15/02/2020 12.15, David T-G wrote: % > % >...and then Carlos E. R. said... % % On 15/02/2020 09.55, Carlos E. % >R. wrote: % | On 14/02/2020 21.36, Dave Howorth wrote: | On Fri, 14 % >Feb 2020 % | 14:24:16 -0600 Nick LeRoy <> wrote: % | % | | That ... % >it % used "|" as quote character, thus breaking things in the editor % >on % next reply. % > % >What's wrong with | as a quote char? Is that because the editor % >is directed by a pipe, or does it just expect > only? % % See above. I pressed "control-R" to reflow. The editor does not % recognize them.
Ah; gotcha. Thanks. Yes, it needs configurability.
But, then, reflowing is evil in the first place ;-)
It works in Thunderbird if the char is ">". That if the mail is signed one way or another changes the quote char is, at least, weird. I looked at the option and did not see how to configure this. Perhaps a hidden option". -- Cheers / Saludos, Carlos E. R. (from 15.1 x86_64 at Telcontar)
On Sat, 15 Feb 2020 12:28:29 +0100 "Carlos E.R." <robin.listas@gmx.es> wrote:
On 15/02/2020 12.24, David T-G wrote:
Carlos --
...and then Carlos E.R. said... % % On 15/02/2020 12.15, David T-G wrote: % > % >...and then Carlos E. R. said... % % On 15/02/2020 09.55, Carlos E. % >R. wrote: % | On 14/02/2020 21.36, Dave Howorth wrote: | On Fri, 14 % >Feb 2020 % | 14:24:16 -0600 Nick LeRoy <> wrote: % | % | | That ... % >it % used "|" as quote character, thus breaking things in the editor % >on % next reply. % > % >What's wrong with | as a quote char? Is that because the editor % >is directed by a pipe, or does it just expect > only? % % See above. I pressed "control-R" to reflow. The editor does not % recognize them.
Ah; gotcha. Thanks. Yes, it needs configurability.
But, then, reflowing is evil in the first place ;-)
It works in Thunderbird if the char is ">". That if the mail is signed one way or another changes the quote char is, at least, weird. I looked at the option and did not see how to configure this. Perhaps a hidden option".
You have: Content-Type: text/plain; charset=utf-8; format=flowed so you're relying on RFC 3676, which says: "4.1. Interpreting Format=Flowed "If the first character of a line is a quote mark (">"), the line is considered to be quoted ..." That is, '>' is the canonical quote character in email and some (most?) MUAs treat it specially as a result. People who don't use '>' for quoting are arbitrarily making the world a worse place, IMHO, with no discernible benefit that I can see. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
* Dave Howorth <dave@howorth.org.uk> [02-15-20 07:09]:
On Sat, 15 Feb 2020 12:28:29 +0100 "Carlos E.R." <robin.listas@gmx.es> wrote:
On 15/02/2020 12.24, David T-G wrote:
Carlos --
...and then Carlos E.R. said... % % On 15/02/2020 12.15, David T-G wrote: % > % >...and then Carlos E. R. said... % % On 15/02/2020 09.55, Carlos E. % >R. wrote: % | On 14/02/2020 21.36, Dave Howorth wrote: | On Fri, 14 % >Feb 2020 % | 14:24:16 -0600 Nick LeRoy <> wrote: % | % | | That ... % >it % used "|" as quote character, thus breaking things in the editor % >on % next reply. % > % >What's wrong with | as a quote char? Is that because the editor % >is directed by a pipe, or does it just expect > only? % % See above. I pressed "control-R" to reflow. The editor does not % recognize them.
Ah; gotcha. Thanks. Yes, it needs configurability.
But, then, reflowing is evil in the first place ;-)
It works in Thunderbird if the char is ">". That if the mail is signed one way or another changes the quote char is, at least, weird. I looked at the option and did not see how to configure this. Perhaps a hidden option".
You have:
Content-Type: text/plain; charset=utf-8; format=flowed
so you're relying on RFC 3676, which says:
"4.1. Interpreting Format=Flowed
"If the first character of a line is a quote mark (">"), the line is considered to be quoted ..."
That is, '>' is the canonical quote character in email and some (most?) MUAs treat it specially as a result.
People who don't use '>' for quoting are arbitrarily making the world a worse place, IMHO, with no discernible benefit that I can see.
Those are the individuals who believe standards and list netiquette are not meant for them. They believe that being non-conformists is reason enough to do as they damn well please. -- (paka)Patrick Shanahan Plainfield, Indiana, USA @ptilopteri http://en.opensuse.org openSUSE Community Member facebook/ptilopteri Photos: http://wahoo.no-ip.org/piwigo paka @ IRCnet freenode -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Paka & Dave, et al -- ...and then Patrick Shanahan said... % % * Dave Howorth <dave@howorth.org.uk> [02-15-20 07:09]: % > On Sat, 15 Feb 2020 12:28:29 +0100 % > "Carlos E.R." <robin.listas@gmx.es> wrote: % > ... % > > It works in Thunderbird if the char is ">". That if the mail is ... % > % > so you're relying on RFC 3676, which says: % > % > "4.1. Interpreting Format=Flowed % > % > "If the first character of a line is a quote mark (">"), the line is % > considered to be quoted ..." % > % > That is, '>' is the canonical quote character in email and some (most?) % > MUAs treat it specially as a result. That is, indeed, the default. It must in fact be escaped by an MTA should it otherwise occur as the first character of a line, which makes for fun. That of course does not mean that it is the *only* option; there is no corresponding "must" associated with quoting. It is, IMNSHO, a poor MUA or MTA or editor (when a part of an MUA) which cannot configure alternate quoting characters. % > % > People who don't use '>' for quoting are arbitrarily making the world a % > worse place, IMHO, with no discernible benefit that I can see. Actually, using different quoting characters makes it much easier to clearly identify who said in an active conversation. Beyond about three quote levels, it becomes very difficult to keep track of the depth and which lines belong to whom when everyone uses the same character. % % Those are the individuals who believe standards and list netiquette are % not meant for them. They believe that being non-conformists is reason % enough to do as they damn well please. There are, indeed, those folks. There are also folks who have been sending email and posting news since before MIME was a thing and who may in fact not even use MIME encoding anyway. Not everyone who does things differently does so without care; sometimes there are actual resons and/or preferences. Didn't Carlos and I have a very similar discussion back in 1991 or so? :-) Have a great weekend! :-D -- David T-G See http://justpickone.org/davidtg/email/ See http://justpickone.org/davidtg/tofu.txt -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 15/02/2020 13.06, Dave Howorth wrote:
On Sat, 15 Feb 2020 12:28:29 +0100 "Carlos E.R." <> wrote:
It works in Thunderbird if the char is ">". That if the mail is signed one way or another changes the quote char is, at least, weird. I looked at the option and did not see how to configure this. Perhaps a hidden option".
You have:
Content-Type: text/plain; charset=utf-8; format=flowed
so you're relying on RFC 3676, which says:
"4.1. Interpreting Format=Flowed
"If the first character of a line is a quote mark (">"), the line is considered to be quoted ..."
That is, '>' is the canonical quote character in email and some (most?) MUAs treat it specially as a result.
People who don't use '>' for quoting are arbitrarily making the world a worse place, IMHO, with no discernible benefit that I can see.
But I did not change the quoting character. It was Thunderbird on its own, automatically and unexpectedly, when signing in a certain way/protocol on email with "Message-ID: <9399f4d9-5336-b6c4-8548-307389212c58@telefonica.net>" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-CA Content-Transfer-Encoding: 7bit -- Cheers / Saludos, Carlos E. R. (from 15.1 x86_64 at Telcontar)
Hello, On Wed, 12 Feb 2020, Yamaban wrote:
yes, you can do it in find itself via: -exec ln ... but I'm not firm enough with the syntax to sprout it here.
I've struggled with that once too, so I saved the canonical solution: ==== find ... -exec $sh -c 'script' find-$sh {} + ==== HTH, -dnh -- "One's never alone with a rubber duck. " -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 2020-02-12 21:59, Yamaban wrote:
find $source_dir -type f -print0 | xargs -0 -n 1 ln -s -t $targed_dir
The "-n 1" restriction to 'xargs' is not necessary - actually that's the gain from "ln ... -t DIR" to accept more arguments. I'd also suggest to add proper quotes around the shell variables. Re. the use of 'ln': from my experience, I'm getting the best, i.e., least surprising result with the -n and -f options. Finally, a -v doesn't harm to see what 'ln' has done. $ find "$source_dir" -type f -print0 | xargs -0 ln -snvft "$targed_dir" Furthermore, the crucial thing here is to find out the relative path from "$targed_dir" to "$source_dir". The tool 'realpath' can help here. Example: # Source and destination directories are in different hierarchy levels. $ source_dir='src' $ target_dir='d1/d2/d3/dest' $ mkdir -pv "$source_dir" "$target_dir" $ ls -logd "$source_dir" "$target_dir" drwxr-xr-x 2 4096 Feb 20 00:36 d1/d2/d3/dest drwxr-xr-x 4 4096 Feb 20 00:31 src # Determine the relative path between src and dest. $ realpath -m "$source_dir" --relative-to "$target_dir" ../../../../src # Change directory to "$target_dir". $ cd "$target_dir" # Create 'flattened' symlinks of all files in the relative $source_dir in ".". $ find ../../../../src -type f -print0 | xargs -0 ln -nsvft . './2' -> '../../../../src/b/2' './4' -> '../../../../src/b/h/j/4' './5' -> '../../../../src/b/h/i/5' './1' -> '../../../../src/1' './2' -> '../../../../src/2' BTW: As you can see, the file "2" exists several times below $source_dir, and therefore the symlink gets overwritten. To work around that, one could use 'ln -i' to prompt for confirmation, but that only works when xargs opens the tty for the 'ln' child process with the new -o, --open-tty option (since findutils-4.7.0). Have fun, Berny -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Hi, all -- ...and then Bernhard Voelker said... % ... % % # Create 'flattened' symlinks of all files in the relative $source_dir in ".". % $ find ../../../../src -type f -print0 | xargs -0 ln -nsvft . % './2' -> '../../../../src/b/2' % './4' -> '../../../../src/b/h/j/4' % './5' -> '../../../../src/b/h/i/5' % './1' -> '../../../../src/1' % './2' -> '../../../../src/2' % % BTW: As you can see, the file "2" exists several times below $source_dir, % and therefore the symlink gets overwritten. [snip] I'm surprised nobody has brought up this problem before now; it's been chewing on me from day one. That's why I would name the links based on the path, like path-to-src-b-2 path-to-src-b-h-j-4 path-to-src-b-h-i-5 path-to-src-1 path-to-src-2 in this example, to disambiguate. HTH & HAND :-D -- David T-G See http://justpickone.org/davidtg/email/ See http://justpickone.org/davidtg/tofu.txt -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Le 20/02/2020 à 05:48, David T-G a écrit :
% BTW: As you can see, the file "2" exists several times below $source_dir, % and therefore the symlink gets overwritten. [snip]
I'm surprised nobody has brought up this problem before now;
I did from the beginning :-) it's been
chewing on me from day one. That's why I would name the links based on the path, like
path-to-src-b-2 path-to-src-b-h-j-4 path-to-src-b-h-i-5 path-to-src-1 path-to-src-2
in this example, to disambiguate.
or add rand number on the name I couldn't follow all the thread, and didn't get the case where this is needed, that may be important jd -- http://dodin.org -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
JD, et al -- ...and then jdd@dodin.org said... % % Le 20/02/2020 à 05:48, David T-G a écrit : % % >% BTW: As you can see, the file "2" exists several times below $source_dir, % >% and therefore the symlink gets overwritten. % >[snip] % > % >I'm surprised nobody has brought up this problem before now; % % I did from the beginning :-) Oh! Good for you and thanks :-) Sorry I missed that. % ... % > path-to-src-b-2 ... % > path-to-src-2 % > % >in this example, to disambiguate. % % or add rand number on the name True, but one presumes that the OP might want to know WHICH "2" was which in the flat dir, and the random number won't help that. % % I couldn't follow all the thread, and didn't get the case where this % is needed, that may be important Just two (or more) same file names in different places in the tree to be flattened. % % jd HAND :-D -- David T-G See http://justpickone.org/davidtg/email/ See http://justpickone.org/davidtg/tofu.txt -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Le 20/02/2020 à 13:47, David T-G a écrit :
True, but one presumes that the OP might want to know WHICH "2" was which in the flat dir, and the random number won't help that.
simply add the rand number to the previous flatten name :-) (variable $RANDOM jdd -- http://dodin.org -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
JD, et al -- ...and then jdd@dodin.org said... % % Le 20/02/2020 à 13:47, David T-G a écrit : % % >True, but one presumes that the OP might want to know WHICH "2" was which % >in the flat dir, and the random number won't help that. % % simply add the rand number to the previous flatten name :-) % (variable $RANDOM Ahhhhhh... OK; I like it. Personally I'd use the inode number and refuse duplicates :-) % % jdd :-D -- David T-G See http://justpickone.org/davidtg/email/ See http://justpickone.org/davidtg/tofu.txt -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 2020-02-20 05:48, David T-G wrote:
That's why I would name the links based on the path, like
path-to-src-b-2 path-to-src-b-h-j-4 path-to-src-b-h-i-5 path-to-src-1 path-to-src-2
in this example, to disambiguate.
Still not 100% bullet-proof, unfortunately:
path-to-src-b-h-j-4
Which of the files in src would lead to the above link? path/to/src/b/h/j/4 path/to/src/b-h/j/4 path/to/src/b/h-j/4 path/to/src/b/h/j-4 There is not answer to this problem which really safe, other than that there is a known discipline of how the files in src are created. Have a nice day, Berny -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Berny, et al -- ...and then Bernhard Voelker said... % % On 2020-02-20 05:48, David T-G wrote: % > That's why I would name the links based % > on the path, like % > % > path-to-src-b-2 % > path-to-src-b-h-j-4 ... % > % > in this example, to disambiguate. % % Still not 100% bullet-proof, unfortunately: Agreed. % % > path-to-src-b-h-j-4 % % Which of the files in src would lead to the above link? % % path/to/src/b/h/j/4 % path/to/src/b-h/j/4 % path/to/src/b/h-j/4 % path/to/src/b/h/j-4 Oh, you rascal :-) Yes, I agree. In real life I've played with different characters to ensure that there is no colliding char and with doubling up (eg path-to-src-b--h-j-4 for your #2) and so on. I personally don't like flattening like this (IMHO it's usually a fix for the wrong reason that doesn't effectively accomplish the actual driving goal), but I've had to support it in the past as well. % % There is not answer to this problem which really safe, % other than that there is a known discipline of how the % files in src are created. Agreed. % % Have a nice day, % Berny Thanks & HAND :-D -- David T-G See http://justpickone.org/davidtg/email/ See http://justpickone.org/davidtg/tofu.txt -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Wed, 19 Feb 2020 23:48:18 -0500, David T-G wrote:
Hi, all --
...and then Bernhard Voelker said... % ... % % # Create 'flattened' symlinks of all files in the relative $source_dir in ".". % $ find ../../../../src -type f -print0 | xargs -0 ln -nsvft . % './2' -> '../../../../src/b/2' % './4' -> '../../../../src/b/h/j/4' % './5' -> '../../../../src/b/h/i/5' % './1' -> '../../../../src/1' % './2' -> '../../../../src/2' % % BTW: As you can see, the file "2" exists several times below $source_dir, % and therefore the symlink gets overwritten. [snip]
I'm surprised nobody has brought up this problem before now; it's been chewing on me from day one. That's why I would name the links based on the path, like
path-to-src-b-2 path-to-src-b-h-j-4 path-to-src-b-h-i-5 path-to-src-1 path-to-src-2
in this example, to disambiguate.
I was aware of that identical file names might cause problems. Exactly for this reason in my original example I used different file names. I wrote this in my original post: Source dir: source/dir1/a/file1 source/dir1/a/file2 source/dir1/a/file3 source/dir1/b/file4 source/dir1/b/file5 source/dir1/b/file6 source/file7 The target should be: target/file1 -> source/dir1/a/file1 target/file2 -> source/dir1/a/file2 target/file3 -> source/dir1/a/file3 target/file4 -> source/dir1/b/file4 target/file5 -> source/dir1/b/file5 target/file6 -> source/dir1/b/file6 target/file7 -> source/file7 You see, there are not repeating file names. Of course, it is very useful to know how to deal with identical file names in different subdirectories. I just did not want to make my example complex complex. Cheers, Istvan -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Hello, On Wed, 12 Feb 2020, Istvan Gabor wrote:
I tried to summarize in the subject what I'd like to do:
I want to create symlinks for all the files within a folder recursively with the symlinks to be in one directory. For example:
Source dir:
source/dir1/a/file1 source/dir1/a/file2 source/dir1/a/file3 source/dir1/b/file4 source/dir1/b/file5 source/dir1/b/file6 source/file7
The target should be:
target/file1 -> source/dir1/a/file1 target/file2 -> source/dir1/a/file2 target/file3 -> source/dir1/a/file3 target/file4 -> source/dir1/b/file4 target/file5 -> source/dir1/b/file5 target/file6 -> source/dir1/b/file6 target/file7 -> source/file7
How could do it?
I created your directory structure. Then: $ mkdir target $ find source -type f -iname '*' -exec /bin/bash -c ' for arg; do ln -si "../$arg" "target/${arg##*\/}"; done; ' find-bash {} + $ ls -l target total 0 lrwxrwxrwx [..] file1 -> ../source/dir1/a/file1 lrwxrwxrwx [..] file2 -> ../source/dir1/a/file2 lrwxrwxrwx [..] file3 -> ../source/dir1/a/file3 lrwxrwxrwx [..] file4 -> ../source/dir1/b/file4 lrwxrwxrwx [..] file5 -> ../source/dir1/b/file5 lrwxrwxrwx [..] file6 -> ../source/dir1/b/file6 lrwxrwxrwx [..] file7 -> ../source/file7 The -iname '*' is there just as an example. HTH, -dnh -- New scheduler deployed on friday was buggy, we learn not to deploy larger changes on fridays anymore ;) -- Adrian Schröter in opensuse-buildservice -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
participants (14)
-
Bernhard Voelker
-
Carlos E. R.
-
Carlos E. R.
-
Carlos E.R.
-
Dave Howorth
-
David Haller
-
David T-G
-
Istvan Gabor
-
James Knott
-
jdd@dodin.org
-
Knurpht-openSUSE
-
Nick LeRoy
-
Patrick Shanahan
-
Yamaban