Last active
June 29, 2018 18:37
-
-
Save constvoidblog/53209519abbbfb8ab58382849ef044cf to your computer and use it in GitHub Desktop.
lftp bookmark wrapper for listing files on a nas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#suppose we have a NAS bookmarked as music w/audio stored in "artist/album" format: | |
# ls_nas.sh music #list all artists | |
# ls_nas.sh music L #list all arists starting w/L | |
# ls_nas.sh music L*/ #list all albums of artists starting w/L | |
if [[ "$#" < 1 ]]; then | |
echo "ls_nas.sh <bookmark> [glob]" | |
echo " " | |
echo "Bookmarks:" | |
lftp -e "bookmark list; quit" | |
exit 1 | |
fi | |
bookmark=$1 | |
glob="*" | |
if [[ "$#" >1 ]]; then | |
glob="$(echo $2 | sed 's/ /\\ /g')*" | |
fi | |
lftp ${bookmark} -e "cls -1d ${glob}; quit" | sed 's/^.* \///g' | column |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment