I have original image is img.jpg.
How can I remove duplicate images which are img.jpg1, img.jpg2, img.jpg3. I want to keep the image which have .jpg extension.
Thanks
Combine the find
command with -regex
and -exec
flags. In this particular example, -exec
simply takes all the dupe images and moves them to trash bin, so you still can recover any of them if you choose so. You can later use rm
command, or clean trash through GUI
testerdir:$ ls
img.jpg img.jpg1 img.jpg2 img.jpg3
testerdir:$ find . -regex ".*\.jpg[1-9]+" -print -exec mv -t $HOME/.local/share/Trash/ {} +
./img.jpg1
./img.jpg3
./img.jpg2
testerdir:$ ls $HOME/.local/share/Trash
expunged/ files/ img.jpg1 img.jpg2 img.jpg3 info/
testerdir:$ ls
img.jpg
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加