GotoNewestFile in a folder

Here you can propose new features, make suggestions etc.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
wanderer
Power Member
Power Member
Posts: 1644
Joined: 2003-03-28, 14:35 UTC
Location: Sol

GotoNewestFile in a folder

Post by *wanderer »

I searched a little but i couldn't find anything related. It would be nice if an internal command (perhaps with a default shortcut - CTRL+SHIFT+N?) existed to place the selection cursor on the newest file in a folder.

Currently this can be achieved by sorting by Date, selecting the first file and then change the sort again to what it was before. With this internal command, if one assigned it to a shortcut, this could be achieved in one step.

There could also be other related commands, like GotoOldestFile, Goto LargestFile, GortoSmallestFile, although i'm not sure they would be as useful as GotoNewestFile.
- Wanderer -

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3 (very rarely nowadays).
x64: Clients/Servers - Win10/Win11 and Win2K16 to Win2K22, mainly Win10 though.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Use button or user-command:

Code: Select all

Command: %ComSpec%
Parameters: /k "for /f "usebackq delims=" %%f in (`dir /b /a-d /o-d`) do start "" "%%COMMANDER_EXE%%" /O /S /L="%%~ff" & exit"
Start path: <empty!>
By playing with dir sorting flags you can also jump to oldest, largest, smallest file etc. You can get all flags by executing dir /? in Windows console. Also additional /tc parameter allows sorting by creation date instead of modify date.
User avatar
wanderer
Power Member
Power Member
Posts: 1644
Joined: 2003-03-28, 14:35 UTC
Location: Sol

Post by *wanderer »

Ha. I had implemented this and forgotten about it for a while (MVV, many thanks BTW) but i just discovered something. If the folder i'm in contains subfolders and files, this command selects the newest subfolder instead of a file and then it enters in it!
- Wanderer -

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3 (very rarely nowadays).
x64: Clients/Servers - Win10/Win11 and Win2K16 to Win2K22, mainly Win10 though.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

If you have /o-d flag for dir command, it shouldn't list subfolders, please check your batch.
User avatar
wanderer
Power Member
Power Member
Posts: 1644
Joined: 2003-03-28, 14:35 UTC
Location: Sol

Post by *wanderer »

For some reason, the bold part from here ('dir /b /a-d /o-d') was missing. It now works almost perfectly. I don't know why but it does not work in the root path of the drive, but since i don't put any files there personally i don't care.

Thanks MVV.
- Wanderer -

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3 (very rarely nowadays).
x64: Clients/Servers - Win10/Win11 and Win2K16 to Win2K22, mainly Win10 though.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

You're welcome. :)

Strange, it works for me in a drive root too.
User avatar
Horst.Epp
Power Member
Power Member
Posts: 7014
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Post by *Horst.Epp »

It works fine here even in any drive root
Tested with TC 8.01 x86 and x64 under Windows 7 Ultimate x64
User avatar
wanderer
Power Member
Power Member
Posts: 1644
Joined: 2003-03-28, 14:35 UTC
Location: Sol

Post by *wanderer »

:) I found out why it doesn't work! The newest file in my C: drive is pagefile.sys, which is hidden. I've set TC to NOT show hid/sys files, so... :)
- Wanderer -

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3 (very rarely nowadays).
x64: Clients/Servers - Win10/Win11 and Win2K16 to Win2K22, mainly Win10 though.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

:D

BTW method really can't work if newest file isn't visible.

Also I think there may be problem if newest file is an archive... So following workaround may be used: /L="%%~ff\:" instead of just /L="%%~ff".
User avatar
wanderer
Power Member
Power Member
Posts: 1644
Joined: 2003-03-28, 14:35 UTC
Location: Sol

Post by *wanderer »

MVV wrote:So following workaround may be used
Yup, it works perfectly. Thanks a lot for the help. :)
- Wanderer -

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3 (very rarely nowadays).
x64: Clients/Servers - Win10/Win11 and Win2K16 to Win2K22, mainly Win10 though.
Post Reply