Folder help please (cm_GoToFirstEntry)

English support forum

Moderators: white, Hacker, petermad, Stefan2

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

Re: Folder help please (cm_GoToFirstEntry)

Post by *Fla$her »

linuxy wrote: 2023-06-15, 18:34 UTC but that link doesn't work for me.
The previous reaction doesn't correspond to this problem. The link works for me. Use this one.
linuxy wrote: 2023-06-15, 18:34 UTC I don't understand it?
Are you asking me? 😕
Overquoting is evil! 👎
linuxy
Junior Member
Junior Member
Posts: 33
Joined: 2022-03-03, 22:07 UTC

Re: Folder help please (cm_GoToFirstEntry)

Post by *linuxy »

Horst.Epp wrote: 2023-06-07, 20:15 UTC Hier my TC button which always goes to the newest entry,
which I find more usefull than the first file.

Code: Select all

TOTALCMD#BAR#DATA
cmd.exe
/k "for /f "usebackq delims=" %%f in (`dir /b /a-d /o-d`) do start "" "%%COMMANDER_EXE%%" /O /S /L="%%~ff\:" & exit"
C:\Tools\Wincmd\Icons\Down-Blue.ico
Newest File

1
-1
Hi friend. Thanks for this code. It sounds like a function I really would love to use. But when I enter this button it opens a CMD window and just fails.
Can you tell me why you think this may be happening?
it says "file not found" in my CMD window after running this button.

Some directories it does work correctly but sometimes certain directories it just fails. Local C drive, no network drives. Thank you for help.
User avatar
petermad
Power Member
Power Member
Posts: 14855
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Folder help please (cm_GoToFirstEntry)

Post by *petermad »

2linuxy
It sounds like a function I really would love to use
You can use this button to go to the NEWEST file:

Code: Select all

TOTALCMD#BAR#DATA
cm_SrcByName 8,cm_SrcByDateTime 2,cm_GoToFirstFile,cm_SrcByName 9

wcmicons.dll,7
Go to newest file
To make the button:
1. Mark the text in the box here above (click SELECT ALL).
2. Copy it to the ClipBoard (press Ctrl+C).
3. Right click on TC's buttonbar and choose "Paste".
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6512
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Folder help please (cm_GoToFirstEntry)

Post by *Horst.Epp »

2petermad
My cmd button to find the newest file works here since Windows 7.
Your solution has the disadvantage that the current sort order is destroyed
my version works with any sorting and doesn't change it in any way.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3593)
TC 11.03 x64 / x86
Everything 1.5.0.1376a (x64), Everything Toolbar 1.3.3, Listary Pro 6.3.0.78
QAP 11.6.3.3 x64
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6512
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Folder help please (cm_GoToFirstEntry)

Post by *Horst.Epp »

linuxy wrote: 2023-06-19, 18:09 UTC
Horst.Epp wrote: 2023-06-07, 20:15 UTC Hier my TC button which always goes to the newest entry,
which I find more usefull than the first file.
Hi friend. Thanks for this code. It sounds like a function I really would love to use. But when I enter this button it opens a CMD window and just fails.
Can you tell me why you think this may be happening?
it says "file not found" in my CMD window after running this button.

Some directories it does work correctly but sometimes certain directories it just fails. Local C drive, no network drives. Thank you for help.
Of course, there is a cmd window for a short time.
It works here since Windows 7 for local drives without any problem.
Maybe you did make an error while copying the button code ?

Moderator message from: white » 2023-06-19, 21:00 UTC

Fixed quoting.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3593)
TC 11.03 x64 / x86
Everything 1.5.0.1376a (x64), Everything Toolbar 1.3.3, Listary Pro 6.3.0.78
QAP 11.6.3.3 x64
User avatar
petermad
Power Member
Power Member
Posts: 14855
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Folder help please (cm_GoToFirstEntry)

Post by *petermad »

2petermad
My cmd button to find the newest file works here since Windows 7.
Your solution has the disadvantage that the current sort order is destroyed
my version works with any sorting and doesn't change it in any way.
What you mean is that your button works since before TC 10.50 - My solution works with Windows 7 too, but NOT with TC prior to 10.50b7.

My solution does preserve the current sort order, because I use cm_SrcByName 8 at the start and cm_SrcByName 9 at the end.
history.txt wrote:25.05.22 Added: New parameters 8 and 9 for all internal commands cm_srcby*, e.g. cm_srcbyname 8 saves the current sort order internally, cm_srcbyname 9 restores it (32/64)
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6512
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Folder help please (cm_GoToFirstEntry)

Post by *Horst.Epp »

petermad wrote: 2023-06-19, 20:58 UTC My solution does preserve the current sort order, because I use cm_SrcByName 8 at the start and cm_SrcByName 9 at the end.
history.txt wrote:25.05.22 Added: New parameters 8 and 9 for all internal commands cm_srcby*, e.g. cm_srcbyname 8 saves the current sort order internally, cm_srcbyname 9 restores it (32/64)
Sorry, I ignored this new functions :cry:
Windows 11 Home x64 Version 23H2 (OS Build 22631.3593)
TC 11.03 x64 / x86
Everything 1.5.0.1376a (x64), Everything Toolbar 1.3.3, Listary Pro 6.3.0.78
QAP 11.6.3.3 x64
linuxy
Junior Member
Junior Member
Posts: 33
Joined: 2022-03-03, 22:07 UTC

Re: Folder help please (cm_GoToFirstEntry)

Post by *linuxy »

Horst.Epp wrote: 2023-06-19, 20:09 UTC
linuxy wrote: 2023-06-19, 18:09 UTC
Horst.Epp wrote: 2023-06-07, 20:15 UTC Hier my TC button which always goes to the newest entry,
which I find more usefull than the first file.
Hi friend. Thanks for this code. It sounds like a function I really would love to use. But when I enter this button it opens a CMD window and just fails.
Can you tell me why you think this may be happening?
it says "file not found" in my CMD window after running this button.

Some directories it does work correctly but sometimes certain directories it just fails. Local C drive, no network drives. Thank you for help.
Of course, there is a cmd window for a short time.
It works here since Windows 7 for local drives without any problem.
Maybe you did make an error while copying the button code ?

Yes, the cmd window is expected. I was just saying, it stays on screen - and says "file not found". That's my issue.
I copied the button code and pasted it, the button is setup correctly but on my system it does not work.
It doesn't just to the wrong file, it doesn't just jump to *any* file.

I'm on Windows 10, using TC 10 but I tried the beta 11 and it still doesn't work.
I have nothing special installed on my system just default stock TC.

Why doesn't my button jump to any file, or the newest one please? :( Permissions? bad luck?
Sometimes it just does nothing and sometimes it shows CMD window file not found. Odd.

Wait, does this button only work in Full view? I am using brief view by default. That would be so frustrating lol.

I just wish TC would offer an option to automatically focus on the copied/moved item. Just an option.

As long as I can get this button to work, that will be fine :)
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6512
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Folder help please (cm_GoToFirstEntry)

Post by *Horst.Epp »

2linuxy
My button works here in full, brief and thumbnail view.
If you can't get it to work, try petermad's button from above.
This also works fine and is pure TC.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3593)
TC 11.03 x64 / x86
Everything 1.5.0.1376a (x64), Everything Toolbar 1.3.3, Listary Pro 6.3.0.78
QAP 11.6.3.3 x64
linuxy
Junior Member
Junior Member
Posts: 33
Joined: 2022-03-03, 22:07 UTC

Re: Folder help please (cm_GoToFirstEntry)

Post by *linuxy »

Horst.Epp wrote: 2023-06-22, 11:35 UTC 2linuxy
My button works here in full, brief and thumbnail view.
If you can't get it to work, try petermad's button from above.
This also works fine and is pure TC.
I will try again, but that button also did not work. I'm happy to make a brief screencast showing I'm doing it correct :) Thank you friend. Maybe because I was expecting it to work on folders too, not just "files?

Just to clarify, when you say "the newest file", does that mean like, the file that's been 'touched' most recently, i.e. the last file/folder to be moved into this location? Right?

Not newest only "created".
Because I agree that button would be amazingly helpful if it "go to the most recently moved/copied file" in the working directory, if I understand :)

Because this button does not select the most recently moved file/folder, it must be looking at some other "date" value. Which date is it?
Does it only do files?

Only files are possible?
Can you please tell me what code I can change for this button to "go to newest file OR folder", whichever is newest? Thank you.

If it's easier to just add a new button that is only for folders, that's great too.
Can we make a button for "go to newest folder?" That would make my job so much easier I would be so thankful! :)
User avatar
petermad
Power Member
Power Member
Posts: 14855
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Folder help please (cm_GoToFirstEntry)

Post by *petermad »

Horst.Epp wrote: 2023-06-19, 22:16 UTC
petermad wrote: 2023-06-19, 20:58 UTC My solution does preserve the current sort order, because I use cm_SrcByName 8 at the start and cm_SrcByName 9 at the end.
history.txt wrote:25.05.22 Added: New parameters 8 and 9 for all internal commands cm_srcby*, e.g. cm_srcbyname 8 saves the current sort order internally, cm_srcbyname 9 restores it (32/64)
Sorry, I ignored this new functions :cry:
BTW, Because my solution only uses TC functions, it also works inside Archives, on FTP sites, and in Virtual folders.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
petermad
Power Member
Power Member
Posts: 14855
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Folder help please (cm_GoToFirstEntry)

Post by *petermad »

Just to clarify, when you say "the newest file", does that mean like, the file that's been 'touched' most recently, i.e. the last file/folder to be moved into this location?
No it means the last Modified files (it is the modified date TC shows in Full View - as Do Explorer)

Because this button does not select the most recently moved file/folder, it must be looking at some other "date" value. Which date is it?
This button will go to the newest folder:

Code: Select all

TOTALCMD#BAR#DATA
%COMSPEC%
/k "for /f "usebackq delims=" %%f in (`dir /b /ad /o-d`) do start "" "%%COMMANDER_EXE%%" /O /S /P /L="%P%%f" & exit"
wcmicons.dll,7
Go to newest folder

1
-1
This will NOT work inside Archives, on FTP sites, and in Virtual folders.



Or you can put this code in your usercmd.ini file:

Code: Select all

[em_hide_all]
cmd=cd |*

[em_gotonewestdir]
cmd=cm_SaveSelection,cm_SwitchDirSort 2,cm_SrcUserSpec 8,cm_SrcByName 8,em_hide_all,cm_SrcByDateTime 2,cm_GoToFirstEntry,cm_SrcUserSpec 9,cm_SrcByName 9,cm_RestoreSelection
menu=Go to newest folder
An then make a button with em_gotonewestdir in the Command field.
This will ALSO work inside Archives, on FTP sites, and in Virtual folders.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
petermad
Power Member
Power Member
Posts: 14855
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Folder help please (cm_GoToFirstEntry)

Post by *petermad »

Only files are possible?
Can you please tell me what code I can change for this button to "go to newest file OR folder", whichever is newest? Thank you.
This button should go to the newest file OR folder:

Code: Select all

TOTALCMD#BAR#DATA
%COMSPEC%
/k "for /f "usebackq delims=" %%f in (`dir /b /o-d-g`) do start "" "%%COMMANDER_EXE%%" /O /S /P /L="%P%%f" & exit"
wcmicons.dll,7
Go to newest file OR folder

1
-1
It will NOT work inside Archives, on FTP sites, and in Virtual folders.

It is not possible to make a button like this using only TC functions, since TC cannot mix folders in between files, but always shows folders at the top.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
linuxy
Junior Member
Junior Member
Posts: 33
Joined: 2022-03-03, 22:07 UTC

Re: Folder help please (cm_GoToFirstEntry)

Post by *linuxy »

petermad wrote: 2023-06-22, 22:04 UTC
Just to clarify, when you say "the newest file", does that mean like, the file that's been 'touched' most recently, i.e. the last file/folder to be moved into this location?
No it means the last Modified files (it is the modified date TC shows in Full View - as Do Explorer)

Because this button does not select the most recently moved file/folder, it must be looking at some other "date" value. Which date is it?
This button will go to the newest folder:

Code: Select all

TOTALCMD#BAR#DATA
%COMSPEC%
/k "for /f "usebackq delims=" %%f in (`dir /b /ad /o-d`) do start "" "%%COMMANDER_EXE%%" /O /S /P /L="%P%%f" & exit"
wcmicons.dll,7
Go to newest folder

1
-1
This will NOT work inside Archives, on FTP sites, and in Virtual folders.



Or you can put this code in your usercmd.ini file:

Code: Select all

[em_hide_all]
cmd=cd |*

[em_gotonewestdir]
cmd=cm_SaveSelection,cm_SwitchDirSort 2,cm_SrcUserSpec 8,cm_SrcByName 8,em_hide_all,cm_SrcByDateTime 2,cm_GoToFirstEntry,cm_SrcUserSpec 9,cm_SrcByName 9,cm_RestoreSelection
menu=Go to newest folder
An then make a button with em_gotonewestdir in the Command field.
This will ALSO work inside Archives, on FTP sites, and in Virtual folders.
You are a genius!!!! :) Thank you

One further question, though.
What is the advantage of adding that to the usercmd.ini file, instead of simply making a button and that's it?
I don't understand which to choose. I just tried button :)
Does the button not work with Archives, on FTP sites, and in Virtual folders?
User avatar
petermad
Power Member
Power Member
Posts: 14855
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Folder help please (cm_GoToFirstEntry)

Post by *petermad »

What is the advantage of adding that to the usercmd.ini file, instead of simply making a button and that's it?
If you look at the em_gotonewestdir command you will see that it uses em_hide_all - so at least the em_hide_all command has to be in the usercomd.ini file.

Instead of using em_gotonewestdir you can put that part directly in a button:

Code: Select all

TOTALCMD#BAR#DATA
cm_SaveSelection,cm_SwitchDirSort 2,cm_SrcUserSpec 8,cm_SrcByName 8,em_hide_all,cm_SrcByDateTime 2,cm_GoToFirstEntry,cm_SrcUserSpec 9,cm_SrcByName 9,cm_RestoreSelection

wcmicons.dll,7
Go to newest folder

Instead of:

Code: Select all

TOTALCMD#BAR#DATA
em_gotonewestdir

wcmicons.dll,7
Go to newest folder
The benefit by having em_gotonewestdir in usercmd.ini is that you can then make a keyboard shortcut to the command if you like to.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Post Reply