GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Updating Many files that have the same name

Sometimes I may have a small file that appear many dozens of times in different folders in my machines and I may want to replace each of these files by a new version that I have. Does Opus have a feature that I have overlooked that does some kind of file Find, and then gives me the option to over-write all of the files I have found using the new one that I have made?

Many thanks
Jonathan Lewin

Is it a text file? If so, with the text data (not the file itself) in the clipboard, the answer to Replace a selected file with file from clipboard? should work.

Leo many thanks for the reply. I went to the thread "Replace a selected file with file from clipboard? " and I think I can see that it may well address my question. Yes, the file I want to update is plain text.

But I feel like a bit of a dunce when reading that thread. I see all of the comments but can't actually find a description of the procedure to be followed to perform the action.
Now let's suppose that I have searched for a file and that I'm looking at a list of about 30 files in various folders, all with the same name and all with the same text content. Is the instruction to place the new content in my clipboard and then to select all of the files in the "found" area and then to perform a Paste operation?

Best wishes.
Jonathan

[s]Yep, except instead of performing a Paste operation, you want to run this command:

Delete QUIET dopusrt /cmd Clipboard PASTE AS {filepath$}

You can put the command on your toolbar or in a menu, or as a hotkey.

Here's a short guide to creating buttons for commands, in case you need it. It's the "raw commands" part at the top that you need in this case; you can ignore the rest.[/s]

Actually, scratch that, I did a quick test and the command does not work for things in the Find Results collection. :frowning:

Apologies for that, another solution is needed, but I'm not sure what a good one is at the moment.

Many thanks Leo. Perhaps I've stumbled onto a possible wish list item. :slight_smile:

This is a bit of a kludge, but it should work okay if you're only using it for small files.

Drawbacks:
[ul][li]No confirmation before it replaces any files. It'll just do it. (Maybe not a drawback, depending on what you want. :slight_smile:)[/li]
[li]It will copy over all the files in parallel. Not a problem with a small replacement file, but would be bad if the replacement file was large.[/li][/ul]

@set NewFile = {dlgopen|Select replacement file} dopusrt /cmd Copy FILE {$NewFile} TO {filepath$|..} AS {file$} WHENEXISTS=replace QUEUE=none

(If you do need it to work with larger files, that can be done by queueing up each operation. The problem with that is there is a short delay between each file, which isn't a problem with large files but would be really annoying for the small-file case, since they delay would take longer than actually copying the file.)

To use this version, you'll need the replacement file to exist somewhere (not just data in the clipboard).

Select the files you want to replace, then run the command. It will prompt you for the replacement file, and will then copy over all of the selected files.

(Here's a short guide to creating buttons for commands, in case you need it. It's the "raw commands" part at the top that you need in this case; you can ignore the rest.)