save a multi-rename operation on files only

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
kodepr
Junior Member
Junior Member
Posts: 47
Joined: 2019-09-05, 08:13 UTC

save a multi-rename operation on files only

Post by *kodepr »

Hello,

I use a screenshot tool that writes all screenshots/screen recordings into a specified folder, like: "k:\subfolder\_FSC\"
I want to define a user-friendly routine that moves all files to a subdir of "k:\subfolder\_FSC\", where the subdir is the date that a screenshot/screen recording was made.

Example:

after making a screenshot the contents of "k:\subfolder\_FSC\" are:
2020-10-15\
2020-10-19\
2020-10-27\
2021-09-06\
2022-02-18_154408.png
SomeShortcut.lnk

then, after running the user-friendly routine, the contents of "k:\subfolder\_FSC\" should be:
2020-10-15\
2020-10-19\
2020-10-27\
2021-09-06\
2022-02-18\2022-02-18_154408.png
SomeShortcut.lnk

Is this possible in Total Commander?
I'm thinking of:
- a defined selection: all files in "k:\subfolder\_FSC\" except for *.lnk and no subfolders should be selected.
- this selection should be sent to a saved multi rename where Rename mask is [=tc.writedate.Y-M-D]\[N]
- ideally all of this can be activated by clicking on a button in the TC toolbar (Command with parameter?) or by clicking on a shortcut (.lnk) to Total Commander with a command line parameter that runs the routine. Last option (.lnk) would be very interesting, because it could be set to run at each computer startup ...

Any idea how the defined selection can be made?
Any idea how it can be sent to multi-rename?
Possible to combine this in a one-click solution?

Thanks in advance!
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: save a multi-rename operation on files only

Post by *Stefan2 »

FROM:
2020-10-15\
2020-10-19\
2020-10-27\
2021-09-06\
2022-02-18_154408.png
SomeShortcut.lnk

TO:
2020-10-15\
2020-10-19\
2020-10-27\
2021-09-06\
2022-02-18\2022-02-18_154408.png
SomeShortcut.lnk




You can utilize MRT (Multi rename-tool) with

[N1-10]\[N]


- select the file(s)
- open MRT
- enter [N1-10]\[N] at the place of [N]
- check the preview and rename

You can save and load that in MRT with F2 key and you can create an button to open that with one mouse click (see link in my sig)





((for testing purpose I have create your provided file list (well done!) on my PC with my new "tool" > https://ghisler.ch/board/viewtopic.php?t=76029 ))

 
kodepr
Junior Member
Junior Member
Posts: 47
Joined: 2019-09-05, 08:13 UTC

Re: save a multi-rename operation on files only

Post by *kodepr »

Hi Stefan2,

I'm sorry if my question wasn't clear enough. I'm actually looking for a one-click solution to move the files to a date-format subdir without having to select the files manually.
I'm currently using Total Commander Version 10.00 64bit
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: save a multi-rename operation on files only

Post by *Stefan2 »

OK, then you have to run a script (PowerShell, VBScript, AutoHotkey) which parse all sub folders,
and if a PNG file is found which is not in the right folder (based on the name), then that folder must be created and the file must be moved.
Maybe someone can take over?
User avatar
Dalai
Power Member
Power Member
Posts: 10022
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: save a multi-rename operation on files only

Post by *Dalai »

If you don't need the current time and date but that of the file that's about to be renamed, there are placeholders [Y] [M] and [D] for the year, month and day, respectively. If you need the current date and time, well, a script might indeed be required.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: save a multi-rename operation on files only

Post by *Stefan2 »

kodepr wrote: 2022-02-18, 17:20 UTC I'm actually looking for a one-click solution to move the files to a date-format subdir without having to select the files manually.

OK, after rethinking I see now there are all new PNGs in the main folder only.
So we just scan that main folder for PNGs and move them to an fitting sub folder (which we create just before)

Here is a one click solution, we can create an button with the below command (or a user defined command where you can assign an keyboard shortcut to)



FROM:
2020-10-15\
2020-10-19\
2020-10-27\
2021-09-06\
2022-02-18_154408.png
2022-02-19_164408.png
2022-02-20_114408.png
2022-02-20_115213.png
2022-02-20_115821.png
SomeShortcut.lnk

TO:
2020-10-15\
2020-10-19\
2020-10-27\
2021-09-06\
2022-02-18\2022-02-18_154408.png
2022-02-19\2022-02-19_164408.png
2022-02-20\2022-02-20_114408.png
2022-02-20\2022-02-20_115213.png
2022-02-20\2022-02-20_115821.png
SomeShortcut.lnk


TRY this PowerShell command:
- go to the folder "k:\subfolder\_FSC\" (backup first, or try on a test folder with copies of your files)
- open PoSh console (or Menu "Commands > Open Command promt" >> in CMD type powershell <enter>)
- paste the below command and press <enter>
Get-ChildItem *.png|ForEach{$FN=$_.Name.substring(0,10);$FN;MD $FN -ea 0;MOVE $_ $FN}




$_ => current item we are working on in the pipeline
$FN => var named "FolderName" or short "FN"
-ea 0 => error action silent continue (if folder already exists)







Bonus:

Open CMD.exe // DOS-Box >> internal command cm_ExecuteDOS

wincmd.ini
[Shortcuts]
;Use 'Ctrl+O' (lower case o) to launch DOS-Box in current path
C+o=cm_ExecuteDOS

- - -

Open PowerShell.exe >> there is no internal command
We create an own "user defined command" in usercmd.ini

usercmd.ini
[em_LaunchPowerShell]
cmd=PowerShell.exe

wincmd.ini
[Shortcuts]
;Use 'Ctrl+0' (number zero) to launch Powershell in current path
C+0=em_LaunchPowerShell

- - -


 
Post Reply