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?
CodePudding user response:
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)
CodePudding user response:
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