automatically getting current working directory name for creating tgz file custom command

Advertisement

Guest

automatically getting current working directory name for creating tgz file custom command

i currently use this custom command :

tar -cz  -f "!?&Archive Name:?archive .tgz!" !&

which means a window popup on wisncp and i can manually enter the tar file name (renaming archive.tgz as the above custom command shows) and hit ok so file going to be compressed as .tar or .tgz file format.

i need to know how instead of "archive.tgz" how to get automatically "current working directory name".tgz for creating tgz file for the selected files in that current working directory ?

any help guys ? i am stucked

put at least a bump if you can . thanks for the help.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
28,507
Location:
Prague, Czechia

Re: automatically getting current working directory name for creating tgz file custom command

tar -cz -f "`basename \`pwd\``.tgz" !&

Reply with quote

Guest

i used this command

tar -cz -f "'basename \'pwd\''.tgz" !&

its not working unfortunately. only create a tar file as 'basename \'pwd\''.tgz

please help me to sort this. im stucked

Reply with quote

Guest

anyway i managed to get this work up to certain level. without popup. anyway here is the working code so far. hole this helps anyone

tar -zcvf "$(basename "$PWD").tgz" !&

i need to know how to do the popup command below to convert as above

tar -cz  -f "!?&Archive Name:?archive .tgz!" !&

i just need to replace "archive .tgz" to "$(basename "$PWD").tgz" but its not working like that at the moment

any help ?

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
28,507
Location:
Prague, Czechia

Anonymous wrote:

i used this command

tar -cz -f "'basename \'pwd\''.tgz" !&

its not working unfortunately. only create a tar file as 'basename \'pwd\''.tgz
There are backticks `, not single quotes '.
Though the $(basename "$PWD") is indeed equivalent.

Anonymous wrote:

i need to know how to do the popup command below to convert as above

tar -cz  -f "!?&Archive Name:?archive .tgz!" !&

i just need to replace "archive .tgz" to "$(basename "$PWD").tgz" but its not working like that at the moment

any help ?
That's not possible using such a simple custom command. You would have to implement much more complicated separate script that does the parsing and prompting and then opens its own session to call the tar.
See https://winscp.net/eng/docs/guide_custom_commands_automation

Reply with quote

Advertisement

You can post new topics in this forum