Page 1 of 1

Find and replace file

PostPosted: Fri Nov 01, 2019 11:49 am
by tryingtoorganise
This is what I'm currently after:
https://snipboard.io/nyckwm.jpg

Basically, I will have the same file in folder A and folder B, and the folders will have different structures. I want to look for file-1 in folder A, and replace it with file-1 from folder B. So folder B always has the better file - in this case higher res video - and folder A is the main folder. I'd love the script to just find one file at a time from folder B and move and replace the same file in folder A.

I've trailed the boards, but can't quite find a solution, so hoping to find something as a new thread.

Re: Find and replace file

PostPosted: Sat Nov 02, 2019 9:58 am
by Dave61
If the folders have a common parent you could run a rule from there and use a condition that checks "any of its subfiles or subfolders" in combination with conditions that ensure that only the folders you want to work on selected.

This is a rule that I set up using it, the purpose is different (identify files with same name but different extensions) but it should give you some idea.

Image

Re: Find and replace file

PostPosted: Sat Nov 02, 2019 3:21 pm
by tryingtoorganise
Dave61 wrote:If the folders have a common parent you could run a rule from there and use a condition that checks "any of its subfiles or subfolders" in combination with conditions that ensure that only the folders you want to work on selected.

This is a rule that I set up using it, the purpose is different (identify files with same name but different extensions) but it should give you some idea.

Image


Great, thank you! I'll give that a try!

Re: Find and replace file

PostPosted: Mon Nov 04, 2019 11:35 am
by Mr_Noodle
I think it might be a bit trickier than that. You'll need a subfolder rule (search the help for it).

Next, you'll need a rule to match the file. If the folders have common parents, you need to go up one level, then down into the other folder, then match for a file with the same name. Something like:
Code: Select all
    If (all) are met
    ...
       If (all) are met for (the enclosing folder)
           If (all) are met for (any of its sub-files)
               Kind is folder
               Name is (folder B)
               If (all) are met for (any of its sub-files)
               ...

Re: Find and replace file

PostPosted: Wed Nov 06, 2019 7:01 am
by Dave61
Mr_Noodle wrote:I think it might be a bit trickier than that. You'll need a subfolder rule (search the help for it).

Next, you'll need a rule to match the file. If the folders have common parents, you need to go up one level, then down into the other folder, then match for a file with the same name.
[/code]

That's what I meant by "in combination with conditions that ensure that only the folders you want to work on selected"