[SOLVED] Move file to folder only if there's no file with that same name

I have a file "Instagram.jpg".
Then I have 3 folders, all inside the same parent folder "Songs":
Song 1
Song 2
Song 3

I want to create a macro that checks folder by folder if a file "Instagram.jpg" already exists. If not, it moves to the folder. If it does, it checks the second folder, etc.

So if all 3 folders don't have "Instagram.jpg" it moves the files "Instagram.jpg" to the same folder, since Song 1 is the first on the list and cancels the macro. Now if folder Song 1 contains a "Instagram.jpg" file, then "Instagram.jpg" would be moved to Song 2, because that folder is empty, and would cancel the macro. The same if Song 2 had the file, it would move it to Song 3, and so on.

I see the IF THEN action has "At this path, a file exists". I would be able to add the path, but then I want it to check for a specific folder, not just "a" file, but "the" file.

Is this possible?

EDIT: I think this is what I need

Yes, you can test for whether a specific filename exists at the location. You would add the filename you want to check for at the end of the path. And that filename could be a variable.

So, to literally check if there is a file called "Instagram.jpg" in the folder "Song 1"

And assuming you will be checking for a different filename each time:

1 Like

Yes I was able to make it work, but now I'm trying something a bit more complex:

I can make it using multiple IF THEN and all that, but I'm wondering if there's a way to make it simpler with fewer actions?

How many folders do you need to check? If it's 3 as in your description above you would just need 3 If Then Actions one after the other (not nested).

Please check that other topic. It has all the info.
It's 7 files and 14 folders.
Right now I'm able to "only" use 7 IF THEN actions and it's working.
I'm just wondering if there's a way to make it simpler?