Replace a file in a folder tree with an updated version?

English support forum

Moderators: white, Hacker, petermad, Stefan2

User avatar
jesped
Member
Member
Posts: 158
Joined: 2005-02-07, 03:28 UTC

Replace a file in a folder tree with an updated version?

Post by *jesped »

Is there a way for Total Commander to replace files in a folder tree with an updated version?

Let's say I want to automatically update a Reshade shader with the new version in all the subfolders of my C:\Games where that file already exists...

or update the nvngx_dlss.dll Nvidia DLSS library...
Fla$her
Power Member
Power Member
Posts: 2390
Joined: 2020-01-18, 04:03 UTC

Re: Replace a file in a folder tree with an updated version?

Post by *Fla$her »

Code: Select all

TOTALCMD#BAR#DATA
%ComSpec% /q/c for /r %d in (.) do >nul xcopy /cdhkqruy "D:\Path\to\file.ext" "%~fd\"

syncui.dll,12
Update file in the folder structure of the active panel

1

Code: Select all

TOTALCMD#BAR#DATA
%ComSpec% /q/c for /r
"%T" %%d in (.) do >nul xcopy /cdhkqruy "%Q%N" "%%~fd\"
syncui.dll,12
Update file in the folder structure of the passive|panel with the same-name file under the cursor

1
Overquoting is evil! ๐Ÿ‘Ž
User avatar
jesped
Member
Member
Posts: 158
Joined: 2005-02-07, 03:28 UTC

Re: Replace a file in a folder tree with an updated version?

Post by *jesped »

Mmm... for some reason neither work for me, but I have no idea why because the cmd windows do not show any content or log.

If I disable the "run minimized" on the second one then the cmd window says: "Invalid drive specification"

My drive and path is a:\Games\
Fla$her
Power Member
Power Member
Posts: 2390
Joined: 2020-01-18, 04:03 UTC

Re: Replace a file in a folder tree with an updated version?

Post by *Fla$her »

Have you read the tooltips describing the behavior of the buttons?
Overquoting is evil! ๐Ÿ‘Ž
User avatar
jesped
Member
Member
Posts: 158
Joined: 2005-02-07, 03:28 UTC

Re: Replace a file in a folder tree with an updated version?

Post by *jesped »

Fla$her
Power Member
Power Member
Posts: 2390
Joined: 2020-01-18, 04:03 UTC

Re: Replace a file in a folder tree with an updated version?

Post by *Fla$her »

What type of drive A:? And what kind of file system does it have?
Overquoting is evil! ๐Ÿ‘Ž
User avatar
jesped
Member
Member
Posts: 158
Joined: 2005-02-07, 03:28 UTC

Re: Replace a file in a folder tree with an updated version?

Post by *jesped »

Fla$her wrote: โ†‘2023-11-21, 08:46 UTC What type of drive A:? And what kind of file system does it have?
It is an NVMe with NTFS.
Fla$her
Power Member
Power Member
Posts: 2390
Joined: 2020-01-18, 04:03 UTC

Re: Replace a file in a folder tree with an updated version?

Post by *Fla$her »

Try then with robocopy:

Code: Select all

TOTALCMD#BAR#DATA
%ComSpec% /q/c for /r
"%T" %%d in (.) do >nul robocopy . "%%~fd" "%Q%N" /ndl /nfl /njh /njs /xl /xo
syncui.dll,12
Update file in the folder structure of the passive|panel with the same-name file under the cursor

1
Overquoting is evil! ๐Ÿ‘Ž
User avatar
jesped
Member
Member
Posts: 158
Joined: 2005-02-07, 03:28 UTC

Re: Replace a file in a folder tree with an updated version?

Post by *jesped »

Exact same thing: blank terminal window and once it goes away I check and none of the files were updated...

Image: https://i.postimg.cc/nhgd1016/image.png

What's that syncui.dll file, btw? I have to set a different icon because I don't have that dll in my system...
Fla$her
Power Member
Power Member
Posts: 2390
Joined: 2020-01-18, 04:03 UTC

Re: Replace a file in a folder tree with an updated version?

Post by *Fla$her »

Did you add a button via the context menu and the 'Paste' item? Right?
Is the edit date of the new file newer than the existing ones?

The library is present on XP-7. Apparently, it was removed from 10/11.
Overquoting is evil! ๐Ÿ‘Ž
User avatar
jesped
Member
Member
Posts: 158
Joined: 2005-02-07, 03:28 UTC

Re: Replace a file in a folder tree with an updated version?

Post by *jesped »

I added the button using copy and paste, yes. Just changed the icon because I have no sync.dll.
File creation date is also newer.

Image: https://i.postimg.cc/SsycLMHB/image.png
Fla$her
Power Member
Power Member
Posts: 2390
Joined: 2020-01-18, 04:03 UTC

Re: Replace a file in a folder tree with an updated version?

Post by *Fla$her »

It's about the date of modification, not creation.
What will be in update.log after execution?:

Code: Select all

TOTALCMD#BAR#DATA
%ComSpec% /q/c for /r
"%T" %%d in (.) do >nul robocopy . "%%~fd" "%Q%N" /log+:update.log /np /ns /ndl /njh /njs /v /xo /xl
wcmicon2.dll,63
Update file in the folder structure of the passive|panel with the same-name file under the cursor

1
Overquoting is evil! ๐Ÿ‘Ž
User avatar
jesped
Member
Member
Posts: 158
Joined: 2005-02-07, 03:28 UTC

Re: Replace a file in a folder tree with an updated version?

Post by *jesped »

Ooooh! it was the modified date. For some absurd reason the modified date was prior to the creation date.
Once set to current date it did the update ok.

Thanks, mate! much appreciated, as having to constantly update these files manually was a total pain in the arse.
Fla$her
Power Member
Power Member
Posts: 2390
Joined: 2020-01-18, 04:03 UTC

Re: Replace a file in a folder tree with an updated version?

Post by *Fla$her »

jesped wrote: โ†‘2023-11-21, 16:27 UTCFor some absurd reason the modified date was prior to the creation date.
The reason is not absurd, but banal. If the option to save dates when copying and unpacking is not set in the settings, then this result is expected when the file appears in the folder. The problem here is that the modification date of the new version of the file doesn't exceed the modification date of the old one.

Since it's necessary to replace dll, it's technically possible to compare versions instead of dates, but in this case batch is not very suitable. If necessary, I can sketch vbs/js.
Overquoting is evil! ๐Ÿ‘Ž
User avatar
jesped
Member
Member
Posts: 158
Joined: 2005-02-07, 03:28 UTC

Re: Replace a file in a folder tree with an updated version?

Post by *jesped »

Fla$her wrote: โ†‘2023-11-21, 23:31 UTC the option to save dates when copying and unpacking is not set in the settings
Where do I set that?
Fla$her wrote: โ†‘2023-11-21, 23:31 UTCSince it's necessary to replace dll, it's technically possible to compare versions instead of dates, but in this case batch is not very suitable. If necessary, I can sketch vbs/js.
Nah, I think it's more than fine with what you already did, man. I can always set the modifed dates to current date on the new files. And it's not just for the DLSS dll, I also need to update .fx .fxh and .addon64 Reshade shaders, which I don't think would have an easy way to compare their version numbers.
Post Reply