Save selection to file without extension?

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
TauMaster
Junior Member
Junior Member
Posts: 6
Joined: 2014-08-23, 20:09 UTC

Save selection to file without extension?

Post by *TauMaster »

Hi!
Is there a way to save selected file names to a file, but without their extensions. Or to copy their names without extensions?
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Copy Save file names without extensions remove extensions

Post by *Stefan2 »

Hi.

No not really,

But you can utilize simple DOS commands like 'for %A do %~nA'



To use this create a button, or create a new command in usercmd.ini:

To create a file with all selected file name without extensions:
** Command: cmd /c
** Parameter: FOR /F "tokens=*" %%A in ('type %F') DO @ECHO %%~nA >> "C:\myFileList.txt"



To copy all selected file name without extensions to clipboard:
** Command: cmd /c
** Parameter: DEL %%tmp%%\x && FOR /F "tokens=*" %%A in ('type %F') DO @ECHO %%~nA >> %%tmp%%\x && type %%tmp%%\x |clip




That "%F" is a TC parameter. While in button dialog press F1 key to read more about such parameters.


Search the forum with that keywords for more tips and tricks...


 
(EDIT: changed %tmp% to %%tmp%% as TC remove always one %)
Last edited by Stefan2 on 2014-08-24, 09:27 UTC, edited 1 time in total.
TauMaster
Junior Member
Junior Member
Posts: 6
Joined: 2014-08-23, 20:09 UTC

Great!

Post by *TauMaster »

Thank you very much! Only some little question - how to make program to ask where the file to be located? For example - not in C:\myFileList.txt, but in the directory, where the selected files are located?
All the best!
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Copy Save file names without extensions remove extensions

Post by *Stefan2 »

 
TauMaster wrote:How to make program to ask where the file to be located?
Add a leading question mark to the para and you will be prompt to modify the command line before executing:

** Parameter: ?FOR /F .......


(With leading "?" you can also inspect every command if it is a valid one.
That's why I modified my script in the last post and doubled the percent signs on %tmp%)

For example - not in C:\myFileList.txt, but in the directory,
where the selected files are located?
Just drop the path part and use the file name only:


** Parameter: FOR /F .......~nA >> "myFileList.txt"


Alternatively you can use the TC parameter %P (again, see the help)
** Parameter: FOR /F .......~nA >> "%P\myFileList.txt"


 
TauMaster
Junior Member
Junior Member
Posts: 6
Joined: 2014-08-23, 20:09 UTC

Thanks!

Post by *TauMaster »

Again thanks! You are very kind and quick.
Wish you luck!
Post Reply