Show newest file in folder (with exclusions)
Moderators: Hacker, petermad, Stefan2, white
Show newest file in folder (with exclusions)
I work a lot with files in my work and often need to archive large folder structures to other servers when the project folder is marked as non-active in our project system. (Large folders fills up our servers so I need to free up space). Unfortunately, people are sometimes still working on files sometimes even if the project folder is marked as non-active in our system.
I need to know Folder size and date of the newest file, but I need to exclude files like thumbs.db and some other files from this counting.
Do anybody know if there exist plugins that can help me achieve this?
I need to know Folder size and date of the newest file, but I need to exclude files like thumbs.db and some other files from this counting.
Do anybody know if there exist plugins that can help me achieve this?
Re: Show newest file in folder (with exclusions)
This button sets the cursor to the newest file in the current dir.
The icon must be set to some icon on your system.
The icon must be set to some icon on your system.
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
Windows 11 Home, Version 24H2 (OS Build 26100.4061)
TC 11.55 RC2 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.4 x64
TC 11.55 RC2 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.4 x64
Re: Show newest file in folder (with exclusions)
2fluor2
Here is a buttton to find the newest file - only using TC functions:
If that is not an option for you, then you can filter out the exclusions first - with a button like this:
Is you aim to find the folder that contains the newest file?
If that is th case you can first enable Branch view (Ctrl+B), use the first button here above and then press Ctrl+B again followed a press on Backspace - then the cursor wil be on the folder that contains the newest file. If you make some em_commands in your usercmd.ini file, all of this can be combined into one button:
Put this in your usercmd.ini file, which is located the same place as your wincmd.ini file (if it does not exist, just make it as an ASCII txt file):
And make a button with the command: em_findfolderwithnewestfile
you can add more file types to the em_hidefiles command separated by spaces.
Here is a buttton to find the newest file - only using TC functions:
Code: Select all
TOTALCMD#BAR#DATA
cm_SrcByName 8,cm_SrcByDateTime 2,cm_GoToFirstFile,cm_SrcByName 9
wcmicons.dll,7
Go to newest file
-1
I recommend that you add the exclusions to your ignore list: Configuration -> Options... -> Ignore listTo 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".
If that is not an option for you, then you can filter out the exclusions first - with a button like this:
Code: Select all
TOTALCMD#BAR#DATA
cd *|thumbs.db
wcmicons.dll,24
Hide thumbs.db
-1
I don't understand this - a file does not have a folder size???I need to know Folder size and date of the newest file
Is you aim to find the folder that contains the newest file?
If that is th case you can first enable Branch view (Ctrl+B), use the first button here above and then press Ctrl+B again followed a press on Backspace - then the cursor wil be on the folder that contains the newest file. If you make some em_commands in your usercmd.ini file, all of this can be combined into one button:
Put this in your usercmd.ini file, which is located the same place as your wincmd.ini file (if it does not exist, just make it as an ASCII txt file):
Code: Select all
[em_hidefiles]
cmd=cd *|thumbs.db
[em_findfolderwithnewestfile]
cmd=em_hidefiles,cm_DirBranch,cm_SrcByName 8,cm_SrcByDateTime 2,cm_GoToFirstFile,cm_SrcByName 9,cm_DirBranch,cm_GoToParent,cm_SrcAllFiles
you can add more file types to the em_hidefiles command separated by spaces.
Last edited by petermad on 2023-02-08, 09:47 UTC, edited 2 times in total.
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: Show newest file in folder (with exclusions)
On the one hand, this is a beautiful solution, but personally it was more convenient for me (even before the appearance of such parameters) to see the list of the latest files:petermad wrote: 2023-02-07, 22:48 UTC cm_SrcByName 8,cm_SrcByDateTime 2,cm_GoToFirstFile,cm_SrcByName 9
Code: Select all
TOTALCMD#BAR#DATA
540,325,324,2050
wciconex.dll,217
Jump to newest file
I have a script tied to Alt+Home to hide what is happening in the panel.
Overquoting is evil! 👎
Re: Show newest file in folder (with exclusions)
2Fla$her
Well without cm_RereadSource I can still use cm_SrcByName 8,cm_SrcByDateTime 2,cm_GoToFirstFile,cm_SrcByName 9 to find the newest file in the filtered list, which can also be usefull.
With the cmd.exe solution that I also used before the 8 and 9 parameters were introduced (on my request), it would be a good idea to use cm_RereadSource and cm_SrcAllFiles first, because the DOS command worked on all files, and it might find a file that was not visible in TC because of one or another kind of filtering.
Well without cm_RereadSource I can still use cm_SrcByName 8,cm_SrcByDateTime 2,cm_GoToFirstFile,cm_SrcByName 9 to find the newest file in the filtered list, which can also be usefull.
With the cmd.exe solution that I also used before the 8 and 9 parameters were introduced (on my request), it would be a good idea to use cm_RereadSource and cm_SrcAllFiles first, because the DOS command worked on all files, and it might find a file that was not visible in TC because of one or another kind of filtering.
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: Show newest file in folder (with exclusions)
The task is precisely to remove filtering. She's only getting in the way.
I don't know which solution you are writing about (I can only assume), but in my opinion, the execution of cm_SrcAllFiles looks more selective. You yourself give an example of hiding thumbs.db, and this is only one of the options.petermad wrote: 2023-02-08, 00:27 UTCWith the cmd.exe solution that I also used before the 8 and 9 parameters were introduced (on my request), it would be a good idea to use cm_RereadSource and cm_SrcAllFiles first
Overquoting is evil! 👎
Re: Show newest file in folder (with exclusions)
I thought the task was to go to the newest file in the displayed list.The task is precisely to remove filtering.
I am talking about this solution, which Horst.Epp showed here above:I don't know which solution you are writing about
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
Code: Select all
[em_ext_gotonewestfile0]
cmd=%COMSPEC% /C
param=if not exist "%P" (echo ) else for /F "usebackq delims=" %%n in (`dir "%P" /b /a-d /o-dn`) do start "" "%%COMMANDER_EXE%%" /O /A /S /L="%P%%n" & exit
menu=Go to newest file
iconic=1
[em_ext_gotonewestfile]
cmd=cm_SaveSelection,cm_SrcAllFiles,em_ext_gotonewestfile0,cm_wait 1000,cm_RestoreSelection
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: Show newest file in folder (with exclusions)
Hiding thumbs.db my way with cd *|thumbs.db will not be cancelled by cm_RereadSourceYou yourself give an example of hiding thumbs.db
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: Show newest file in folder (with exclusions)
Then there would be no point in cm_RereadSource.petermad wrote: 2023-02-08, 01:13 UTCI thought the task was to go to the newest file in the displayed list.
ОК.
Of course not. But I wrote about another command:petermad wrote: 2023-02-08, 01:22 UTCHiding thumbs.db my way with cd *|thumbs.db will not be cancelled by cm_RereadSource
Overquoting is evil! 👎