Skip to content

Instantly share code, notes, and snippets.

@bmatthewshea
Last active October 9, 2026 19:40
Show Gist options
  • Select an option

  • Save bmatthewshea/730a0bafadece7fedff20bca690b6c17 to your computer and use it in GitHub Desktop.

Select an option

Save bmatthewshea/730a0bafadece7fedff20bca690b6c17 to your computer and use it in GitHub Desktop.
Simple find script to find paths over 260 chars on Linux samba server.
#!/bin/sh
## find_260_char_paths.sh
## By Brady Shea - 9 Oct 2026
# Linux prefix on path (not in windows):
# /opt/shares-new/ (16 chars)
#
# Windows prefix on path (shown/used in windows):
# \\abc-fileserver\ (17 chars)
#
# offset = 1 (linux path would be shorter by 1 chars and not counted in windows - this value can also be negative)
# define path and offset
mypath='/opt/shares-new/'
offset=1
printf "\nCHECKING PATH: %s \n\n" ${mypath}
printf "Linux prefix: %s\n" ${mypath}
printf "Windows prefix: %s\n" "\\\\abc-fileserver\\"
printf "PATH OFFSET/DIFFERENCE: %d \n\n" $offset
sleep 5
# execute - Add length in RED to end of line
find "${mypath}" -name "lost+found" -prune -o -type f | awk -v offset=$offset 'length($0) + offset > 260 {print $0, "\033[0;31m(" length($0)+offset ")\033[0m\n"}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment