Multiple file replacement

Hello All
Is it possible to do a mass search and replace with files in DOpus? I have about 100 files in different directories that I need to update from another file. I can search for the files easily but I don't know if a replace can be done at the same time. The files are all images.

Regards

Phil

I am not aware of a way to accomplish this with Opus raw commands (in Opus 8 or the upcoming Opus 9). I have a very similar need. It will be some time before I can get my head around this (I have a lot of projects on my plate right now).

But once I think this through a little, I will most likely be able to create an NT Command Script that works from inside an Opus 9 User Command or toolbar button. Hopefully I can get something that works in a one-click operation.

[quote="Phil_C"]Hello All
Is it possible to do a mass search and replace with files in DOpus? I have about 100 files in different directories that I need to update from another file. I can search for the files easily but I don't know if a replace can be done at the same time. The files are all images.

Regards

Phil[/quote]

Assuming the file you want to replace the others with is C:\newfile.jpg:

Create a new button and set the function type to MS-DOS Batch and make it run this:

cmd /c copy /Y C:\newfile.jpg {filepath$} pause

(The "cmd /c" means it will use the MS-DOS copy command instead of Opus's own Copy command. There's a better way to do this in Opus 9 but it doesn't make much difference for this example, so "cmd /c" is fine.)

If you run that button with the files you want to replace selected then C:\newfile.jpg will be copied over every selected file.

Make sure you haven't selected anything else by mistake as it will not prompt you for confirmation!

I'm cooking up some Opus 9 Buttons/User Commands that will help manage the risks better and automate the process. But it looks like the Find operation will need to be a separate button than the Replace operation. There is no way to get Opus to wait for its Find Operation to complete before firing off the replace operation.

Right now I have three buttons completed and tested:[ol][li] Find the files (or wild card strings) you want to replace and display the resulting file collection in a new tab in the Source Lister.[/li]
[li] Select All Files in the resulting file collection tab in the Source Lister.[/li]
[li] Replace All files selected in the resulting file collection tab in the Source Lister with a file of your choosing--you are prompted to select this file. This button is an NT Command script that uses the Windows Copy command, like Leo suggests above. It also produces a Notepad report that lists all file replacements attempted as well as their success/failure results.[/li][/ol]

Right now it's three toolbar buttons. I'm going to try to make it a parameter-driven User Command. That way, if you have a routine Find-and-Replace operation to perform, you can automate it a little bit more.

I've been needing something like this for a looooong time.

Hello All
My apologies for not replying earlier and thanking you all for the suggestions. To be honest I had forgotten all about this thread. I have been using Leo's idea for a few days now but I was wondering if it could be expanded on. Say I have several files to replace. Would it be possible to replace them with a file of the same name from another directory. For example if I have the following old files;
File1.txt
File2.txt
File3.txt
File4.txt

all listed in a DOpus Find Results window (all have different paths)
Then I have the same named files but newer in a temp directory of say C:/Temp. Would it be possible to replace the old File1 with the new File1 etc. I think it would be possible using a modification of leo's code provided the files are ordered the same but I am not sure.

Any help would be greatly appreciated. I do have DOpus 9 so kenalcock's suggestion might be more appropriate.

Regards

Phil

Something like this should do it:

cmd /c copy /Y C:\temp\{file$} {filepath$} pause

Hello Leo
Thank you very much for the code. It works perfectly.

Regards

Phil