Copy names of all files in a folder

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
spikey
Member
Member
Posts: 123
Joined: 2005-07-20, 08:37 UTC

Copy names of all files in a folder

Post by *spikey »

Can TC copy the names of all files in a folder to the Windows clipboard, and this can be pasted into a text editor?

Thanks for any information on how to do this.
User avatar
petermad
Power Member
Power Member
Posts: 16032
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Copy names of all files in a folder

Post by *petermad »

Menu -> Mark -> "Copy Selected Names To Clipboard"
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
Fla$her
Power Member
Power Member
Posts: 2998
Joined: 2020-01-18, 04:03 UTC

Re: Copy names of all files in a folder

Post by *Fla$her »

spikey wrote: 2023-07-15, 22:55 UTC Can TC copy the names of all files in a folder to the Windows clipboard, and this can be pasted into a text editor?
Why do you need a clipboard if the list is needed in the editor? Isn't it easier to create a list right away?
%ComSpec% /q/v/c chcp 65001>nul&set f=list.txt&(dir /a-d/b|findstr/xv !f!>!f!)&start "" !f!
Overquoting is evil! 👎
User avatar
petermad
Power Member
Power Member
Posts: 16032
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Copy names of all files in a folder

Post by *petermad »

To copy to a file, bypassing the clipboard you can also use the internal command cm_SaveSelectionToFile (subsequently: cm_SaveSelectionToFileA, cm_SaveSelectionToFileW, cm_SaveDetailsToFile, cm_SaveDetailsToFileA, cm_SaveDetailsToFileW, cm_SaveHdrDetailsToFile, cm_SaveHdrDetailsToFileA and cm_SaveHdrDetailsToFileW)



Here is a list of user commands I use in my Extended menus (see signature) for copying file names:

Code: Select all

[em_ext_saveselection]
cmd=SAVESELECTION
param="%PSELECTEDFILES.txt"
menu=Save file names in the file SELECTEDFILES.txt

[em_ext_saveselectiona]
cmd=SAVESELECTIONA
param="%PSELECTEDFILES.txt"
menu=Save file names in the file SELECTEDFILES.txt (force ANSI)

[em_ext_saveselectionw]
cmd=SAVESELECTIONW
param="%PSELECTEDFILES.txt"
menu=Save file names in the file SELECTEDFILES.txt (force Unicode)

[em_ext_savedetails]
cmd=SAVEDETAILS
param="%PSELECTEDFILES.txt"
menu=Save file names + all columns in the file SELECTEDFILES.txt

[em_ext_savedetailsa]
cmd=SAVEDETAILSA
param="%PSELECTEDFILES.txt"
menu=Save file names + all columns in the file SELECTEDFILES.txt (force ANSI)

[em_ext_savedetailsw]
cmd=SAVEDETAILSW
param="%PSELECTEDFILES.txt"
menu=Save file names + all columns in the file SELECTEDFILES.txt (force Unicode)



[em_ext_copynamestofile1]
cmd=%COMSPEC% /C
param=if not exist "%P" (echo Error!) else copy "%UF" "%PSELECTEDFILES.txt"
menu=Copy selected filenames to file in current folder (UTF-8)
iconic=1

[em_ext_copynamestofile]
cmd=cm_SaveSelection,em_ext_copynamestofile1,cm_wait 1000,cm_RestoreSelection
menu=Copy selected filenames to file in current folder (UTF-8), restore selection

[em_ext_copynamestofile1a]
cmd=%COMSPEC% /C
param=if not exist "%P" (echo Error!) else copy "%f" "%PSELECTEDFILES.txt"
menu=Copy selected short filenames to file in current folder (ANSI)
iconic=1

[em_ext_copynamestofile1b]
cmd=%COMSPEC% /C
param=if not exist "%P" (echo Error!) else copy "%d" "%PSELECTEDFILES.txt"
menu=Copy selected short filenames to file in current folde (ASCII)
iconic=1

[em_ext_copynamestofile2a]
cmd=%COMSPEC% /C
param=if not exist "%P" (echo Error!) else copy "%L" "%PSELECTEDFILES.txt"
menu=Copy selected filenames with full path to file in current folder (ANSI)
iconic=1

[em_ext_copynamestofile2b]
cmd=%COMSPEC% /C
param=if not exist "%P" (echo Error!) else copy "%WL" "%PSELECTEDFILES.txt"
menu=Copy selected filenames with full path to file in current folder (Unicode)
iconic=1

[em_ext_copynamestofile2c]
cmd=%COMSPEC% /C
param=if not exist "%P" (echo Error!) else copy "%UL" "%PSELECTEDFILES.txt"
menu=Copy selected filenames with full path to file in current folder (UTF-8)
iconic=1

[em_ext_copynamestofile2d]
cmd=%COMSPEC% /C
param=if not exist "%P" (echo Error!) else copy "%l" "%PSELECTEDFILES.txt"
menu=Copy selected short filenames with full path to file in current folder (ANSI)
iconic=1

[em_ext_copynamestofile2e]
cmd=%COMSPEC% /C
param=if not exist "%P" (echo Error!) else copy "%D" "%PSELECTEDFILES.txt"
menu=Copy selected short filenames with full path to file in current folder (ASCII)
iconic=1

[em_ext_copynamestofile3]
cmd=%COMSPEC% /C
param=if not exist "%P" (echo Error!) else (if exist "%PSELECTEDFILES.txt" del "%PSELECTEDFILES.txt") && for /F "usebackq delims=" %%n in (%UF) do if "%%~nn"=="" (echo %%n>> "%PSELECTEDFILES.txt") else echo %%~nn>> "%PSELECTEDFILES.txt"
menu=Copy selected filenames without filetype to file in current folder
iconic=1
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
Fla$her
Power Member
Power Member
Posts: 2998
Joined: 2020-01-18, 04:03 UTC

Re: Copy names of all files in a folder

Post by *Fla$her »

2petermad
Where does the condition say anything about the selection?
Pointing to all files already excludes this need.
I brought the command where no extra actions are required.
Overquoting is evil! 👎
User avatar
petermad
Power Member
Power Member
Posts: 16032
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Copy names of all files in a folder

Post by *petermad »

2Fla$her
Where does the condition say anything about bypassing the clipboard?
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
Fla$her
Power Member
Power Member
Posts: 2998
Joined: 2020-01-18, 04:03 UTC

Re: Copy names of all files in a folder

Post by *Fla$her »

2petermad
Was there any answer from the author of the topic to my question about this?
I constantly encounter on various forums that, due to incompetence, users list unclaimed actions in tasks to obtain the final result.
Add: I hope you are competent enough not to find pointing out the XY problem (2) offensive? ;)
Last edited by Fla$her on 2023-07-16, 23:32 UTC, edited 1 time in total.
Overquoting is evil! 👎
User avatar
white
Power Member
Power Member
Posts: 5807
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Copy names of all files in a folder

Post by *white »

Moderator message from: white » 2023-07-16, 19:30 UTC

Fla$her wrote: 2023-07-16, 19:21 UTC 2petermad
Was there any answer from the author of the topic to my question about this?
I constantly encounter on various forums that, due to incompetence, users list unclaimed actions in tasks to obtain the final result.
Fla$her, stop insulting people. It is not allowed here.

Also, do not respond to this post in this thread and do not abuse the report system to complain about it.

If you keep violating forum rules, you risk further actions against you.
User avatar
white
Power Member
Power Member
Posts: 5807
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Copy names of all files in a folder

Post by *white »

Moderator message from: white » 2023-07-16, 20:47 UTC

Post by Fla$her deleted.
Fla$her, if you want to comment on a moderator's comment, do so by sending an email to the moderator or to Mr. Ghisler.
Post Reply