Creating a folder named using date from file under cursor?
Moderators: Hacker, petermad, Stefan2, white
Creating a folder named using date from file under cursor?
Hello!
The default behaviour of TC when pressing F7 (over a directory) is that the new folder will be suggested the same name as the one where you're standing, which is great.
I am starting, these days, to put my photographs into folders that have a date string first: "20150322_car_expo"
Since i start from a folder/SD-card of many photographs that will be split into multiple folders, it would be nice to be able to create the dirnames quickly and get the date without needing to read the date string manually.
Could some function be made, that when executed, will give me a dirname requester just like with F7 but it will take the creation/modification date from the file under cursor and wait for me to fill in the rest?
If its complicated to create something that waits, i suppose i could make the folder completely first with just the date string in the name, and then rename it with F2.
(Yes, i'm lazy and always looking for ways to optimize processes)
cheers
The default behaviour of TC when pressing F7 (over a directory) is that the new folder will be suggested the same name as the one where you're standing, which is great.
I am starting, these days, to put my photographs into folders that have a date string first: "20150322_car_expo"
Since i start from a folder/SD-card of many photographs that will be split into multiple folders, it would be nice to be able to create the dirnames quickly and get the date without needing to read the date string manually.
Could some function be made, that when executed, will give me a dirname requester just like with F7 but it will take the creation/modification date from the file under cursor and wait for me to fill in the rest?
If its complicated to create something that waits, i suppose i could make the folder completely first with just the date string in the name, and then rename it with F2.
(Yes, i'm lazy and always looking for ways to optimize processes)
cheers
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
This command isn't one of TC internal command, but it is part of petermad's Extended Total Commander MenusRedTiF wrote:Hi sybariten,
I'm working with this command:
em_ext_newdir
"Make directory with same name as file under cursor in opposite panel"
Will this solve your problem?
Rgds RedTiF
Re: Creating a folder named using date from file under curso
If you do not need unicode, you can use TCBL with a command inside TCBL.inisybariten wrote:Hello!
The default behaviour of TC when pressing F7 (over a directory) is that the new folder will be suggested the same name as the one where you're standing, which is great.
I am starting, these days, to put my photographs into folders that have a date string first: "20150322_car_expo"
Since i start from a folder/SD-card of many photographs that will be split into multiple folders, it would be nice to be able to create the dirnames quickly and get the date without needing to read the date string manually.
Could some function be made, that when executed, will give me a dirname requester just like with F7 but it will take the creation/modification date from the file under cursor and wait for me to fill in the rest?
If its complicated to create something that waits, i suppose i could make the folder completely first with just the date string in the name, and then rename it with F2.
(Yes, i'm lazy and always looking for ways to optimize processes)
cheers
Code: Select all
command:<pathTo\tcbl.exe
parameters: -i %L FolderWithFileDate %T>
Code: Select all
[FolderWithFileDate]
;Request the same folder name suffix for all files at once
ini=1 Directory Name YYYYMMDD_<Name> Folder
;no automatic quote
ini=q
;Date format for file %Y year %m month %d day => YYYYMMDD
ini=# %Y%m%d
pre=@echo off
; create folder using first parameter %T from TC
; add creation time $c
; add internal variable 1
cmd=echo use file $n $#c $#m $#a to create "$#c_$_1"
cmd=set FolderNAME=$1\$#c_$_1
cmd=md "%FolderNAME%"
;;; copy file to folder (optionnal )
cmd=copy "$f" "%FolderNAME%\$n"
-- edited to add copy of file
Last edited by nsp on 2015-06-05, 12:19 UTC, edited 1 time in total.
AHK script: Create folder name date file under cursor?
Here is a AutoHotkey script for your issue:sybariten wrote:I am starting, these days, to put my photographs into folders
that have a date string first: "20150322_car_expo"
Since i start from a folder/SD-card of many photographs that will be split into multiple folders,
it would be nice to be able to create the dirnames quickly
and get the date without needing to read the date string manually.
Could some function be made, that when executed, will give me a dirname requester just like with F7
but it will take the creation/modification date from the file under cursor
and wait for me to fill in the rest?
;// 1. Select one file.
;// 2. Execute this script to read file date and prompt you to create a new folder.
;// 3. Folder will be created with name, taken form file date [file will be moved to new folder]
Code: Select all
;===================================================================================== Description
;// http://ghisler.ch/board/viewtopic.php?p=296756&sid=8c4d126bf1aee4f7a090d16fbac1ca43#296756
;// sybariten PostPosted: Thu Jun 04, 2015 15:18
;// Creating a folder named using date from file under cursor?
;// Could some function be made, that when executed, will give me a dirname requester just like with F7
;// but it will take the creation/modification date from the file under cursor and wait for me to fill in the rest?
;// Example: "20150322_car_expo"
;//
;// Needs http://ahkscript.org/download/1.0/AutoHotkey104805.zip
;//
;// TC Command
;// Command: path\to\AutoHotkey.exe path\to\ThisScript.ahk
;// Parameter:
;// Start path:
;// Icon file: path\to\AutoHotkey.exe
;// Tooltip: Create folder from date of selected file, move file to new folder
;//
;// 1. Select one file.
;// 2. Execute this script to read file date and prompt you to create a new folder.
;// 3. Folder will be created with name, taken form file date [file will be moved to new folder]
;===================================================================================== AHK Basics
;// S C R I P T S E T T I N G S:
#SingleInstance force ;Skips the dialog box and replaces the old instance automatically
;#NoTrayIcon ;if you don't want a tray icon for this AutoHotkey program.
#NoEnv ;Recommended for performance and compatibility with future AutoHotkey releases.
;===
;This script information:
strAppName = CreateFolderMoveFile
strVersion = 0.01
strVerDate = 2015-06-05
;===
;// TC related stuff
;//Check if running under Total Commander:
If not WinActive("ahk_class TTOTAL_CMD") {
MsgBox Please execute this application from within Total Commander.
ExitApp
}
;//Get TC handle:
WinGet, vTCHandleID, ID, A
ControlGetFocus, vCurrFocus, ahk_id %vTCHandleID%
;===================================================================================== AHK Script code
;// T H E C O D E:
;//Store current clipboard content:
vClipboardStorage := clipboard
;//Execute TC-command:
;//TOTALCMD.INC: cm_CopyNamesToClip=2017;Copy filenames to clipboard
;//SendMessage, 0x0433, <command ID here>, , , ahk_id%vTCHandleID%
SendMessage, 0x0433, 2017, , , ahk_id%vTCHandleID%
;// GET CLIPBOARD CONTENT:
vMySelectedFile := clipboard
;msgbox % vMySelectedFile
;//Check if more than one file was selected:
;//IfInString, var, SearchString
IfInString, vMySelectedFile, `r`n
{
MsgBox To many files. Please select one single file only. Script quits here.
ExitApp
}
;//sybariten wrote: but it will take the creation/modification date from the file under cursor ...
;//Get the date from the file meta data
;//FileGetTime, OutputVar [, Filename, WhichTime]
;//Which timestamp to retrieve:
;//M = Modification time (this is the default if the parameter is omitted)
;//C = Creation time ;//A = Last access time
FileGetTime, vMyFileDate , %vMySelectedFile%, M
;//Format the date to a wanted format:
;//FormatTime, OutputVar [, YYYYMMDDHH24MISS, Format]
;//Or here just the first 8 signs
;//sybariten wrote: Example: "20150322_car_expo"
;//StringLeft, OutputVar, InputVar, Count
StringLeft, vMyFileDate, vMyFileDate, 8
;//Create a new folder, if not already exist:
;//If var is [not] type
If vMyFileDate is time
{
;//sybariten wrote: and wait for me to fill in the rest? ;// Example: "20150322_car_expo"
;//InputBox, OutputVar [, Title, Prompt, HIDE, Width, Height, X, Y, Font, Timeout, Default]
InputBox, vMyFolderName , Total Commander, New folder (directory), , ,130 , , , , , %vMyFileDate%_
if ErrorLevel
ExitApp
else
{
;FileCreateDir, DirName
FileCreateDir, %vMyFolderName%
}
}
;//Move the file into the newly created folder:
;//FileMove, SourcePattern, DestPattern [, Flag]
;FileMove, %vMySelectedFile%, %vMyFolderName%
;Restore last clipboard content:
clipboard := vClipboardStorage
ExitApp
;//DONE <EOF>
HTH?

sybariten,
Here is another AutoHotkey script, which you can assign to eg. Shift-F7 by creating a user command.
HTH
Roman
Here is another AutoHotkey script, which you can assign to eg. Shift-F7 by creating a user command.
Code: Select all
ClipboardBak = %ClipboardAll%
Clipboard =
PostMessage, 1075, 2018, , , A
ClipWait
FileGetTime, TimeStamp, %Clipboard%
PostMessage, 1075, 907, , , A
Clipboard = %ClipboardBak%
FormatTime, TimeStamp, %TimeStamp%, yyyyMMdd
WinWaitActive, Total Commander ahk_class TCOMBOINPUT
SendInput, %TimeStamp%
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.