Copying search results

I would like to be able to search a large number of files and then copy those found to a different directory. The problem is that doing that causes the files to be copied without the path. So if I have a file named fileA in the main directory and another with the same name in the temp directory (main/fileA and temp/FileA) and if both are found in the search, when they are copied to some directory, they are just added as fileA so the second copy causes a popup asking if the file should be overwritten.

I'm, currently getting around this by touching all of the found files, sorting the source directory by date changed and then copying. But that causes a problem with the dates on the files since I use those for other purposes, not to mention it involves more steps.

Is there a way to do this already built-into DO or is a new button needed?

Using Directory Opus Pro 11.15 Build 5666 x64

You definitely don't need to change the timestamps just to sort by location. The Location or Location(Relative) columns will handle that.

The best way to handle this when dealing with large numbers of files is to use a Copy Filter. See Filtered Operations for details, and shout if you need help.

(When dealing with a small number of files, using Flat View is often easier, as that can copy and preserve the relative paths when doing so. But it's not great for thousands and thousands of files, at least currently, as Flat View can be slow when working with that many items.)

Thanks Leo but I don't think you understand the problem, or maybe I don't understand your reply. The problem is the path isn't being recognized when copying search results. I looked at the page you referenced but don't see anything related to that but I may be missing it. Please try this in case I am not explaining the problem clearly:

1 - create a directory with a sub-directory.
2 - place the same file in each of those directories.
3 - do a search on something in that file so the search result shows both files.
4 - select both files and copy them to some other directory. You will get an overwrite dialog.

You can skip the search part entirely when using a Copy Filter.

e.g.

[ol][li] Turn on the Copy Filter (in the Copy Files button-menu, left of the default toolbars).[/li]
[li] Go to [b]C:[/b] and select Program Files[/li]
[li] Click Copy Files[/li]
[li] You'll be prompted to define a filter. Set it to Name, Match, dopus.exe (for example) and click OK.[/li]
[li] The copy will begin, and in the destination folder side you'll get Program Files\GPSoftware\Directory Opus\dopus.exe[/li][/ol]

Essentially, it will perform the search and the copy at once, while preserving relative paths.

Yes, I understand how to use the filter, I think. What I don't understand is how to copy files that only have the word "bob" in them without doing a search.

Use a Name (if you want "bob" in the filename) or Contains (if you want "bob" inside the file itself, and it's a format whose contents can be searched) clause when defining the filter.

e.g. Name, Match, bob, [x] Use Wildcards.

Dear Jack,

May be the following button can help you to solve the "overwrite dialog" problem.

@nofilenamequoting CreateFolder NAME="{destpath$|noterm}\{filepath|..|nopath|noterm}" Copy FILE="{filepath$|noterm}" TO="{destpath$|noterm}\{filepath|..|nopath|noterm}"

This button will copy files to destination folder by creating the files parent folder structure in the destination.
After yo do your search, select both or all files and try to copy them to some other directory with above button.

I think tbone has posted the code in another thread.

Regards,

I think that button will confuse things here. It's for a much more specific purpose (it will only replicate the files' direct parent folders, not anything above them) and won't work in all situations for what this thread is about, and shouldn't be needed either. It also won't have good copy progress displays.

Changing all the "nopath" to "noroot" might make it useful here (then it would replicate the whole folder structure, from the root of the source drive down; but still not relative to the source path, and still with poor progress display, neither of which are problems with the solution I've been describing in the rest of the thread).

The filtered file copy I've been describing in the rest of the thread should still be preferable in most cases, and I'd rather not go on a tangent explaining the pros & cons of an alternative solution that wouldn't be as good (unless something very specific is needed, and hasn't been mentioned yet).

0xt1n: Thank you for the suggestion. Part of the reason for not responding before now was in trying to figure out how to do this with a button.

leo: I tried what you described and it does exactly what I need done. Thanks for taking the time to explain it. however, the procedure of enabling the copy filter, doing the search and disabling the filter doesn't make the process easier, especially if I forget to reset the filter. It does save having to Touch the files but otherwise it doesn't seem to be a better way to do it. Is your last reply saying this cannot be made into a button?

You can make a button or hotkey which runs Copy FILTER and then use that when you want to do this.

That avoids having to turn the filter on and off, and leaves the normal Copy button acting as it usually does, unfiltered.