I have a folder Google Photos. This is from a google photos takeout. The way the takeout works is there are multiple folders with date names
➜ ~/Google Photos => tree |head -n 20 . ├── 1979-12-31 │ ├── icon-24x24.png │ ├── icon-24x24.png.json │ ├── icon_local_color.png │ ├── icon_local_color.png.json │ ├── metadata.json │ ├── viewer-14.png │ ├── viewer-14.png.json │ ├── viewer-28.png │ └── viewer-28.png.json ├── 2001-07-24 │ ├── heic0109a.jpg │ ├── heic0109a.jpg.json │ └── metadata.json ├── 2003-01-06 │ ├── ASPdotNET_logo.jpg │ ├── ASPdotNET_logo.jpg.json │ ├── darkBlue_GRAD.jpg │ ├── darkBlue_GRAD.jpg.json
I would like to move all the files which do not end in json to a new folder called
./all_photos. The issue is that I may have two files with the same name in folders.
For example in the folder
1979-12-31 I may have a file called
a.jpg and in the folder
2001-07-24 I may also have another file called
a.jpg. Solutions I have looked at move the files but overwrite or skip if there is a potential overwrite. I would like to change the filenames as shown:
2001-07-24_a.jpg. This will ensure there are no files with the same name and therefore no overwriting.
I am on a Linux server and I imagine the best way to do this would be through Linux find command but I am unsure of the exact commands so would like a helping hand.