Skip to content

Instantly share code, notes, and snippets.

@skurscheid
Created March 9, 2023 13:15
Show Gist options
  • Save skurscheid/8e8f41b4dfed2653966d7e1c934ecf24 to your computer and use it in GitHub Desktop.
Save skurscheid/8e8f41b4dfed2653966d7e1c934ecf24 to your computer and use it in GitHub Desktop.
create_symbolic_links_from_directory_content
#!/bin/bash
#this command takes the list of all files in the current directory,
#excludes all files that contain "Undetermined" in their filename
#gets the realpath for the given file
#and creates a symbolic link in the $newpath
export newpath="/this/is/the/new/path"
ls . | grep -v Undetermined | xargs -d $'\n' sh -c 'for arg do path=$(realpath "$arg"); ln -s ${path} ${newpath}"$arg"; done' _
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment