Pastebin
Paste #18434: No description
< previous paste - next paste>
Pasted by Anonymous Coward
$ cat func.zsh
function find_sidecar () {
file_a="$1"
search_path="$2"
# check if file_a is aae file or heic file
if [[ $file_a == *.aae ]]; then
# we need to find a .heic file
find "$search_path" -type f -iname "${file_a:r}.heic"
else
# we need to find a .aae file
find "$search_path" -type f -iname "${file_a:r}.aae"
fi
}
function find_sidecar2 () {
local file_a="$1"
local search_path="$2"
local -A other=( aae heic heic aae )
local file_ext=$file_a:e
local ext=$other[$file_ext]
#echo $search_path/**/$file_a:r.$ext([1])
echo $search_path/**/$file_a:r.$ext([1])
}
$ find [R0 J0 L:0.24 0.20 0.20 U:0+06:53 pts/5 3049H]
.
./101-copy2
./101-copy2/img_2009.heic
./101-copy2/img_2007.heic
./101-copy2/img_2010.heic
./101-copy2/img_2008.heic
./100
./100/img_1005.heic
./100/img_1007.heic
./100/img_1003.heic
./100/img_1006.heic
./100/img_1004.heic
./100/img_1008.heic
./103
./103/img_3006.heic
./103/img_3005.heic
./101
./101/img_2006.heic
./101/img_2007.heic
./101/img_2008.heic
./func.zsh
./img_2007.aae
./101-copy
./101-copy/img_2006.heic
./101-copy/img_2004.heic
./101-copy/img_2007.heic
./101-copy/img_2005.heic
./101-copy/img_2003.heic
~/tmp/aae-script $ find_sidecar2 img_2007.aae . [R0 J0 L:0.43 0.27 0.23 U:0+06:54 pts/5 3054H]
./101-copy2/img_2007.heic
~/tmp/aae-script $ find_sidecar img_2007.aae . [R0 J0 L:0.43 0.27 0.23 U:0+06:54 pts/5 3055H]
./101-copy2/img_2007.heic
./101/img_2007.heic
./101-copy/img_2007.heic
New Paste
Go to most recent paste.