"Auto-surgical" file replacement!

Discussion & Support for xplorer² professional

Moderators: fgagnon, nikos, Site Mods

Post Reply
User avatar
Ross
Bronze Member
Bronze Member
Posts: 102
Joined: 2008 May 02, 19:51

"Auto-surgical" file replacement!

Post by Ross »

Hi, I have this current situation, which appears to be challenging to me:

I have a big folder with multiple subfolders, each of those with numerous files. This means that, in this case, searching one by one is counterproductive.

Those subfolders are like this: folder A contains a file named "winston_1.mp3", along many others, while folder B contains a file named "winston_2.mp3" (and many other files), folder C contains a "winston_3.mp3", and so on. They're similar. Now think about folders going from A to Z, and "winston_x.mp3" having x varying from 1 to 26.

Since only one of the "winstons" is correct, I found it, copied to a separate folder, then I need to put a copy of it in each one of the subfolders to update the entire archive with the correct one, getting rid of all other winstons_x.mp3.

Simple drag-and-drop is out of question because the files are not named exactly the same, so there will be no prompt. Also, hitting F6 to move to opposite panel will be too manual as well since I'll have to go to the folders one by one.

This question is relevant because this will not apply to just one series of file replacements, but along with "winston" there are a lot of other files in the "correct files folder". To find the correct ones in each folder to replace will have to be done by searching for a string in the filenames.

Is this doable in X2? Thanks in advance.
User avatar
nikos
Site Admin
Site Admin
Posts: 15771
Joined: 2002 Feb 07, 15:57
Location: UK
Contact:

Post by nikos »

what i can recommend off the top of my head is this:

use the fuzzy search box to locate all winston_x.mp3 files quickly, then delete all of them. Finally paste the 'good' version into each of the folders

the fuzzy name search is that little box saying 100 next to the NAMED field in find files dialog. If you make it smaller you increase the fuzziness

if your names have a predictable pattern it would be simpler to leave fuzziness to 100 then just use a wildcard to find all the files eg

winston_*.mp3
Mr.Pleasant
Silver Member
Silver Member
Posts: 281
Joined: 2006 Dec 29, 12:56
Location: Utrecht, NL

Post by Mr.Pleasant »

As an addition to
Finally paste the 'good' version into each of the folders
You can use 'multi paste' ('Edit' - 'Paste Special...' - 'Multi paste') to paste one or a set of files into a host of folders that you have selected before multipasting. Those selected folders can be inside a Scrap container, in case they can not be selected inside a single pane in the normal X2 window.
User avatar
Ross
Bronze Member
Bronze Member
Posts: 102
Joined: 2008 May 02, 19:51

Post by Ross »

what i can recommend off the top of my head is this:

use the fuzzy search box to locate all winston_x.mp3 files quickly, then delete all of them. Finally paste the 'good' version into each of the folders

the fuzzy name search is that little box saying 100 next to the NAMED field in find files dialog. If you make it smaller you increase the fuzziness

if your names have a predictable pattern it would be simpler to leave fuzziness to 100 then just use a wildcard to find all the files eg

winston_*.mp3


Hmm, I see, but I forgot to mention two things :(

1 - Not all folders in there actually have the winston_x.mp3 files... there are, in fact, more than 26 folders, but only those 26 (which can't be found automatically) have 'winstons', others don't. By doing what you suggested I would clutter the 'healthy' folders (the ones with no 'winstons').

2 - The names have a predictable pattern, yet not as simple to use a simple wildcard *: they're actually not only winston_x.mp3, but y_winston_x.mp3, both x and y variables. If I take the correct version and do a multipaste, the file itself will be correct, but the name inside the folders will not, so the program will read wrongly. I mean, let's say winston_5.mp3, from folder "E", is the right one. I take it separately to begin pasting to the other folders, but I need it to be named "winston_1.mp3" in folder A, "winston_2.mp3" in folder B, "winston3.mp3" in folder C, and so on. Got it?

@ Mr.Pleasant: thanks for the tip, but I need first to make clear the point just above :)
profess
Silver Member
Silver Member
Posts: 307
Joined: 2003 Oct 06, 11:39

Post by profess »

Nikos and Others,

I recall something with 'check builds' being used when we had a 'challenge' topic (we should do those again btw).

Could this be used? Plucking at straws...

Osei
Live life...
User avatar
nikos
Site Admin
Site Admin
Posts: 15771
Joined: 2002 Feb 07, 15:57
Location: UK
Contact:

Post by nikos »

if wildcards are not suitable, try to see if the fuzzy name location will work. You can experiment with values 90, 80... and see if you can catch all your files
Mr.Pleasant
Silver Member
Silver Member
Posts: 281
Joined: 2006 Dec 29, 12:56
Location: Utrecht, NL

Post by Mr.Pleasant »

Two things which you might want to consider:
1. I'm not sure what exactly your goal is with this structure. But I tried to see it from a different angle, and maybe (that means also: probably not) you could do your work with hard links. If you're on a NTFS drive, you could, just once, remove all the copies from the folders, and replace them with 'hard link' copies ('Edit' - 'Paste special' - 'Hard link') from what you called 'the right one'.
You can also rename the hard link copies so that each has its proper name.
The advantage now, is that you just edit one of the files, and all the other ones will be updated immediately. Since you seem to work with mp3, I suppose you're not editing the files, but compiling(?) them, and overwrite the old one. I believe the other hard links also gets updated when one of them is overwritten, but you'll have to try that yourself.
Be careful though: Hard linking is a bit like magic, if you aren't familiar with it. Just like me :oops:

2. Try this, if you can search for them. In your example, I'd say looking for plain 'winston' should do the trick. If you harvest too much, then drop out the redundant ones, and save what you have in the scrap container to a CIDA file for a next time. Now comes the trick: once you have the files in a scrap container, select them all - or at least the ones that need to be replaced. Open the command script (ctrl+B), and give this command:

Code: Select all

copy "[path and name of the right file]" "$F"
Press the 'execute (DOS)' button to have each file in the scrap ("$F") replaced by the right one with the name of the replaced one.
User avatar
Ross
Bronze Member
Bronze Member
Posts: 102
Joined: 2008 May 02, 19:51

Post by Ross »

Mr. Pleasant got it exactly right!

So, let me clear you up.
Of course the "winstons" are examples, it was the first name which came into my mind.

The real purpose is for a game - Counter-Strike in particular. What happens is, whenever you get into a server, you download, mandatorily, the custom .WAV (not mp3) files for some particular game events, such as headshooting. BUT, each server creates its particular folder and uploads to it their custom wave files. Some are named headshot.wav, others are headshot_ultimate.wav, 1_headshot.wav, and so on.

But, as I said, not all folders have "headshot.wav" variants. Uploading (copying) to each of them could hog the HD.

So, Pleasant's idea #2 worked. At least I'll try now!

Yet, I don't even know what a hardlink is :P

Thanks you all!
Post Reply