Find and replace file

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Find and replace file 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.
tryingtoorganise
 
Posts: 6
Joined: Mon Jul 23, 2018 6:31 am

Re: Find and replace file 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
Dave61
 
Posts: 113
Joined: Tue Jul 10, 2012 4:56 pm

Re: Find and replace file 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!
tryingtoorganise
 
Posts: 6
Joined: Mon Jul 23, 2018 6:31 am

Re: Find and replace file 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)
               ...
Mr_Noodle
Site Admin
 
Posts: 11174
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Find and replace file 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"
Dave61
 
Posts: 113
Joined: Tue Jul 10, 2012 4:56 pm


Return to Support