I have been away from scripting for years, so I was wondering if someone can help in the below.
I am migrating from Google Photos to Amazon Photos (about 40k photos). Here is an example of what I downloaded from Google:
IMG-20180601-WA0004-modifié.jpg
IMG-20180601-WA0004.jpg
IMG-20180601-WA0004.jpg.json
IMG-20180601-WA0005-modifié.jpg
IMG-20180601-WA0005.jpg
IMG-20180601-WA0005.jpg.json
IMG-20180601-WA0008-modifié.jpg
IMG-20180601-WA0008.jpg
IMG-20180601-WA0008.jpg.json
IMG-20180601-WA0009-modifié.jpg
IMG-20180601-WA0009.jpg
IMG-20180601-WA0009.jpg.json
IMG-20180601-WA0010-modifié.jpg
IMG-20180601-WA0010.jpg
IMG-20180601-WA0010.jpg.json
IMG-20180601-WA0011-modifié.jpg
IMG-20180601-WA0011.jpg
IMG-20180601-WA0011.jpg.json
IMG-20180601-WA0013-modifié.jpg
IMG-20180601-WA0013.jpg
IMG-20180601-WA0013.jpg.json
IMG-20180601-WA0014-modifié.jpg
IMG-20180601-WA0014.jpg
IMG-20180601-WA0014.jpg.json
IMG-20180601-WA0015-modifié.jpg
IMG-20180601-WA0015.jpg
IMG-20180601-WA0015.jpg.json
IMG-20180601-WA0020.jpg
IMG-20180601-WA0020.jpg.json
IMG-20180601-WA0036-modifié.jpg
IMG-20180601-WA0036.jpg
IMG-20180601-WA0036.jpg.json
VID-20180601-WA0012.mp4.json
VID_20180601_195857.mp4.json
métadonnées.json
I want the following:
- Search across all the directories within the main folder of the downloaded photos,
- delete all the video files such as mov, mp4, mpeg, mpg, avi, m4v and wmv (note that sometimes the file extension is in caps)
- for the photos, you will notice that most of the file names are duplicated (one without the word "modifié" and the other with). Note that not all of them have a "modifié" version, e.g. IMG-20180601-WA0020.jpg. I would like to delete all photos where the filename does not contain the word "modifié" except if the original file does not have a "modifié" version then keep it (IMG-20180601-WA0020.jpg is an example to keep).
- I prefer to keep the json files as is if they are not related to a video file otherwise delete them.