我已经从丢失的分区中恢复了图像,我需要对它们进行排序,或者在每个图像的EXIF数据中按创建日期将它们放入文件夹中。
我已经安装了digiKam,也安装了shotwell,但没有找到在任何选项上执行此操作的方法。
任何人都可以向我解释如何使用这些程序或通过任何其他方法进行操作吗?
我已经从丢失的分区中恢复了图像,我需要对它们进行排序,或者在每个图像的EXIF数据中按创建日期将它们放入文件夹中。
我已经安装了digiKam,也安装了shotwell,但没有找到在任何选项上执行此操作的方法。
任何人都可以向我解释如何使用这些程序或通过任何其他方法进行操作吗?
Answers:
我最喜欢的解决方案是将文件日期设置为与exif照片日期相同。这样做,您可以使用任何文件浏览器工具对文件进行排序。
apt-get install jhead
)jhead -ft *
。这将使用exif元数据的创建日期设置文件系统中的文件日期我建议使用exiftool。您可以使用安装
sudo apt install exiftool
这是一个示例命令,该命令根据创建日期以YYYYMMDD格式重命名文件,并在末尾附加序列号。
exiftool '-filename<CreateDate' -d %Y%m%d%%-.4nc.%%le -r
这是一个示例命令,该命令image.jpg
以'YYYY-MM-DD'格式进入以创建日期为名称的目录。
exiftool -d %Y-%m-%d "-directory<datetimeoriginal" image.jpg
文档中还有更多示例命令:https : //sno.phy.queensu.ca/~phil/exiftool/filename.html
cd /home/me/Pictures/staging
先执行操作,然后调用exiftool。
Rapid Photo Downloader是一个很棒的工具
添加PPA
sudo apt-add-repository ppa:dlynch3/ppa
更新和安装
sudo apt-get update
sudo apt-get install rapid-photo-downloader
使用“丢失的分区”作为输入源,并根据Rapid Photo Downloader中的exif数据配置目标路径/文件名
最简单的使用方法:
jhead -n%Y/%m/%d/%Y%m%d%H%M /Destination/*.jpg
它将所有文件从当前目录排序,移动并重命名为具有唯一文件名/Year/Month/Day/YearMonthDayHourMinute.jpg的漂亮目录结构
它仅适用于* .jpg文件面团,不适用于RAW
jhead -n%Y/%m/%d/%Y-%m-%d--%H%M-- *.jpg
现在有一个名为nautilus-columns的扩展,它添加了EXIF数据以及MP3(ID3),PDF和更多元数据。这些新列也可以用作排序源。
安装方式:
sudo add-apt-repository ppa:atarea/nautilus-extensions
sudo apt update
sudo apt install nautilus-columns
这是我正在使用的代码。它使用YYYYMMDD_originalname.jpg重命名照片。
#! /bin/bash
shopt -s globstar || exit
for PIC in **
do
# look only for jpg
if [[ "$PIC" =~ \.JPG$ ]] || [[ "$PIC" =~ \.jpg$ ]]; then
# ignore jpg that have 8 numbers at beginning followed by _ or after IMG_ or P_ and followed by _ (already date stamped)
if [[ "$PIC" =~ [[:digit:]]{8}_.*$ ]] || [[ "$PIC" =~ IMG_[[:digit:]]{8}_.*$] ]] || [[ "$PIC" =~ P_[[:digit:]]{8}_.*$] ]]; then
:
else
# get the date and time from the tag
DATE=$(exiftool -p '$DateTimeOriginal' "$PIC" | sed 's/[: ]//g')
echo "file_$PIC"
# customize date, in this case eliminate the time, getting only the date in 8 numbers and adding _
DATEMOD2=$(echo $DATE | sed -e 's/^\(.\{8\}\).*/\1_/')
echo "datemod2_$DATEMOD2"
# check if DateTimeOriginal was present
if [[ "$PIC" == "$DATEMOD2$PIC" ]];then
# as DateTimeOriginal is not present try with HistoryWhen
DATE=$(exiftool -p '$HistoryWhen' "$PIC" | sed 's/[: ]//g')
DATEMOD2B=$(echo $DATE | sed -e 's/^\(.\{8\}\).*/\1_/')
echo "datemod2B_$DATEMOD2B"
# check if HistoryWhen is present
if [[ "$PIC" == "$DATEMOD2B$PIC" ]];then
# nor the tag DateTimeOriginal, nor HistoryWhen present
echo "skip"
else
# this will be done
echo "mv -i "$PIC" $(dirname "$PIC")/"$DATEMOD2B""$PIC""
#uncomment if you like it
#mv -i "$PIC" $(dirname "$PIC")/"$DATEMOD2B""$PIC"
fi
else
# this will be done
echo "mv -i "$PIC" $(dirname "$PIC")/"$DATEMOD2""$PIC""
#uncomment if you like it
#mv -i "$PIC" $(dirname "$PIC")/"$DATEMOD2""$PIC"
fi
fi
fi
done
编辑。在此修改中,通过触摸将标签中的日期传递到名称以及日期属性。另外,如果这些标签不存在,则将修改标签的日期传递到文件名。
#! /bin/bash
shopt -s globstar || exit
for PIC in **
do
# look only for jpg
if [[ "$PIC" =~ \.JPG$ ]] || [[ "$PIC" =~ \.jpg$ ]]; then
echo "file_$PIC"
# get the date and time from the tag DateTimeOriginal
DATE=$(exiftool -p '$DateTimeOriginal' "$PIC" | sed 's/[: ]//g')
LONGDATE=$(echo $DATE | sed -e 's/^\(.\{12\}\).*/\1/')
# check if DateTimeOriginal is 0000... OR empty
if [[ "$LONGDATE" != "000000000000" ]] && [[ -n "$LONGDATE" ]]; then
echo "datetimeoriginal_$LONGDATE"
# modify the attribute date with the info in the tag date
touch -t $LONGDATE "$PIC"
# customize date, in this case eliminate the time, getting only the date in 8 numbers and adding _
DATEMOD2=$(echo $DATE | sed -e 's/^\(.\{8\}\).*/\1_/')
echo "datemod2_$DATEMOD2"
# skip renaming if
# 8 numbers at beginning followed by _ or after IMG_ or P_ and followed by _ (already date stamped)
if [[ "$PIC" =~ [[:digit:]]{8}_.*$ ]] || [[ "$PIC" =~ IMG_[[:digit:]]{8}_.*$] ]] || [[ "$PIC" =~ P_[[:digit:]]{8}_.*$] ]]; then
:
else
# this will be done
filename=$(basename "$PIC")
echo "$filename"
echo "mv -i \""$PIC"\" \""$(dirname "$PIC")"/"$DATEMOD2""$filename"\""
#uncomment if you like it
mv -i "$PIC" "$(dirname "$PIC")/$DATEMOD2$filename"
fi
else
# get the date and time from the tag HistoryWhen
DATE=$(exiftool -p '$HistoryWhen' "$PIC" | sed 's/[: ]//g')
LONGDATE=$(echo $DATE | sed -e 's/^\(.\{12\}\).*/\1/')
# check if Historywhen is 0000... or empty
if [[ "$LONGDATE" != "000000000000" ]] && [[ -n "$LONGDATE" ]]; then
echo "historywhentag_$LONGDATE"
touch -t $LONGDATE "$PIC"
DATEMOD2B=$(echo $DATE | sed -e 's/^\(.\{8\}\).*/\1_/')
echo "datemod2B_$DATEMOD2B"
if [[ "$PIC" =~ [[:digit:]]{8}_.*$ ]] || [[ "$PIC" =~ IMG_[[:digit:]]{8}_.*$] ]] || [[ "$PIC" =~ P_[[:digit:]]{8}_.*$] ]]; then
:
else
# this will be done
filename=$(basename "$PIC")
echo "$filename"
echo "mv -i \""$PIC"\" \""$(dirname "$PIC")"/"$DATEMOD2B""$filename"\""
#uncomment if you like it
mv -i "$PIC" "$(dirname "$PIC")/$DATEMOD2B$filename"
fi
else
# get the date and time from the tag tag filemodifydate
DATE=$(exiftool -p '$filemodifydate' "$PIC" | sed 's/[: ]//g')
LONGDATE=$(echo $DATE | sed -e 's/^\(.\{12\}\).*/\1/')
# check if filemodifydate is 0000... or empty
if [[ "$LONGDATE" != "000000000000" ]] && [[ -n "$LONGDATE" ]]; then
#echo "filemodifydatetag_$LONGDATE"
#touch -t $LONGDATE "$PIC"
DATEMOD2C=$(echo $DATE | sed -e 's/^\(.\{8\}\).*/\1_/')
echo "datemod2C_$DATEMOD2C"
if [[ "$PIC" =~ [[:digit:]]{8}_.*$ ]] || [[ "$PIC" =~ IMG_[[:digit:]]{8}_.*$] ]] || [[ "$PIC" =~ P_[[:digit:]]{8}_.*$] ]]; then
:
else
# this will be done
filename=$(basename "$PIC")
echo "$filename"
echo "mv -i \""$PIC"\" \""$(dirname "$PIC")"/"$DATEMOD2C""$filename"\""
#uncomment if you like it
mv -i "$PIC" "$(dirname "$PIC")/$DATEMOD2C$filename"
fi
else
echo "Error, NO date available"
fi
fi
fi
fi
done
用于按文件夹排序(年和月)(YYYYMM):
exiftool "-Directory<DateTimeOriginal" -d "%Y%m" *