简体   繁体   中英

Automator Quick action to Move JPG that have RAW copy

i have a pictures in a folder with the similar names but different extension

2008.03.13__20.53.49__DSC_3020.NEF
2008.03.13__20.53.12__DSC_3018.jpg
2008.03.13__20.53.12__DSC_3018.NEF

I need to move.JPG files that have corresponding.NEF into a subfolder called "jpeg duplicate of NEF" i have been using a such script on Windows

chcp 1252 >NUL
color A
if exist "jpeg duplicate of NEF"\ goto :move
if not exist "jpeg duplicate of NEF" mkdir "jpeg duplicate of NEF"
if errorlevel 1 (
echo Error create "jpeg duplicate of NEF"
goto :end
) else (
echo ......Directory created jpeg duplicate of NEF......
)
:move
for %%I in (*.jpg) do if exist %%~dI%%~pI%%~nI.NEF move "%%I" "%%~dI%%~pIjpeg duplicate of NEF\"
:end
echo ____________jpeg duplicate to folder, NEF leave in main folder____________
pause

But now i'm using MacBook and would like use similar script as a quick action. (i think it has to be bash script?) Can you help me with this please?

This may be what you want:

cd '/Volumes/Foto/_TMP move JPG test' || exit
mkdir -p 'jpeg duplicate of NEF'
for jpeg in *.jpg; do
    [[ -f ${jpeg%jpg}NEF ]] && mv "$jpeg" 'jpeg duplicate of NEF'
done

It shows an error, and creating a folder "jpeg duplicate of NEF" but inside users directory not inside the current directory (like this /Users/aleksandr/jpeg duplicate of NEF)

Screenshot

这是我对Automator的设置

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM