Move file if greater in size

Javascript renaming examples. Javascript renaming is supported in version 3 or newer.

Move file if greater in size

Postby bit4010040 » Tue Apr 01, 2025 1:48 am

I have a camera roll folder with a lot of photos in it. The folder is flat with no sub-folders. I want to move these photos into an existing structured hierarchy based on year and month e.g. %Y\%m\. I know how to do this, however, if it finds a file with the same name I want it to check the destination file's size against the file that is being moved and only move it if the source file is bigger, otherwise, the file should be ignored (and ideally the source file should be deleted as this is a move).

Thanks
bit4010040
 
Posts: 4
Joined: Tue Apr 01, 2025 12:41 am

Re: Move file if greater in size

Postby Admin » Tue Apr 01, 2025 5:19 am

Hi, just to clarify, it they are all in a flat folder and you are moving the files into their subfolder based on their date, their name would always be different?
Admin
Site Admin
 
Posts: 2883
Joined: Tue Mar 08, 2005 8:39 pm

Re: Move file if greater in size

Postby bit4010040 » Tue Apr 01, 2025 9:41 pm

I see what you mean. Actually, the files are being copied into an existing folder structure, which already contains some of these photos. I'm organizing my photos because some were uploaded to Google Photos, downgraded in resolution, and then resynced to my computer. I have a large camera roll folder on my local computer and a 'Pictures' folder with a year/month structure where I’m consolidating everything. However, some files seem to overlap between these folders. My goal is to ensure I keep the highest resolution versions.
bit4010040
 
Posts: 4
Joined: Tue Apr 01, 2025 12:41 am

Re: Move file if greater in size

Postby Admin » Wed Apr 02, 2025 5:43 am

Hi, so the files to match have same exact name but different size, and one file is in the folder structure and the other file in the flat folder?
Admin
Site Admin
 
Posts: 2883
Joined: Tue Mar 08, 2005 8:39 pm

Re: Move file if greater in size

Postby bit4010040 » Wed Apr 02, 2025 7:09 pm

Correct, they both have the same name but a different size. Yes, one is in the folder structure (destination) and one is in the flat folder (source).
bit4010040
 
Posts: 4
Joined: Tue Apr 01, 2025 12:41 am

Re: Move file if greater in size

Postby bit4010040 » Tue Apr 08, 2025 1:19 am

Hi, I started working through my files manually, however digging deeper into the source and destination folders I've found quite a few files that have different names, but the images are the same. Therefore, I don't think bulk rename is going to be able to handle this scenario. This is more of a dedup problem than a rename issue. Letting you know in case you were investing time with this issue. Thanks again PS Bulk Rename is an excellent utility, so is still extremely useful.
bit4010040
 
Posts: 4
Joined: Tue Apr 01, 2025 12:41 am

Re: Move file if greater in size

Postby Admin » Sun Apr 13, 2025 6:44 am

Hi, thank you for letting us know! yes, this sounds more like a dedup problem.
Admin
Site Admin
 
Posts: 2883
Joined: Tue Mar 08, 2005 8:39 pm


Return to Javascript Renaming