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

Author Message
Guest




i currently use this custom command :

Code:
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.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26331
Location: Prague, Czechia
tar -cz -f "`basename \`pwd\``.tgz" !&
Guest




i used this command

Code:
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
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

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


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

Code:
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 ?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26331
Location: Prague, Czechia
Anonymous wrote:
i used this command

Code:
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

Code:
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
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License