Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > General

Reply
 
Thread Tools Display Modes
  #1  
Old 09-21-2020, 03:57 PM
joey joey is offline
Registered User
 
Join Date: Sep 2020
Posts: 2
Variables in Command Manager commands

I need to be able to run a command that copies a file from a system to a backup location. The source filename is always the same, but I would like the destination filename to be timestamped. (Ie., source is "flash.tar.gz", and destination would be 2020-09-21-flash.tar.gz.)

I can automate everything else with an entry in the Command Manager, but I do not see any obvious way to insert something like a timestamp. I can write a short script, but that would then require an external file (external to the VanDyke/SecureCRT settings). If there was an option within the Command Manager, it would allow a simple command like this to stay within my SecureCRT settings.

If this does not exist, is it something that could be requested? Or is this something that was always intended to be scripted, rather than a variable that can be accessed from a Command?

Thanks.
Reply With Quote
  #2  
Old 09-21-2020, 04:55 PM
cboyack cboyack is offline
VanDyke Technical Support
 
Join Date: Apr 2020
Location: Albuquerque, NM
Posts: 60
Hi joey,

Your initial question is a bit ambiguous. Are you trying to copy a file from a remote system to a backup location on the same remote system but renamed with a timestamp?

Or, are you attempting to download a file from the remote system to your local system and then rename it with the YYYY-MM-DD addition to the name?
__________________
Thanks,
--Cameron

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 10-01-2020, 12:30 PM
joey joey is offline
Registered User
 
Join Date: Sep 2020
Posts: 2
Specifically, I have a file that is generated on the local system that always has the same name, like "backup.tar.gz". I would like to be able to use a command on the local system that would copy the file to another system. In order to prevent overwriting the previous backup/file, I would like to append the date to the end of the filename, so the copy on the remote system is "backup-2020-10-01.tar.gz".

An example would be:
Code:
command-to-generate-local-backup-file
scp /filesystem/folder/backup.tar.gz  usr@server.example.com:/backups/backup-2020-10-01.tar.gz
Password: (entered manually)
command-to-delete-local-backup-file
This would allow the creation of the file, transfer with automatic naming at destination, then deletion of file on local system (since local system only has enough extra space to have one backup at a time).

Does that help clarify what I am trying to do? (For what it is worth, I could imagine that being able to use this sort of variable, especially if it uses a standard set of formats [similar to what Linux can do with things like %F-%T], would be useful if I was trying to move or rename files either direction.)
Reply With Quote
  #4  
Old 10-02-2020, 04:29 PM
cboyack cboyack is offline
VanDyke Technical Support
 
Join Date: Apr 2020
Location: Albuquerque, NM
Posts: 60
Hi joey,

The ability to utilize variables for date/time substitution from the command-line is not a capability which is native to SecureCRT at this time.

I've added a feature request on your behalf so that the product director may be able to evaluate it for potential inclusion in some future release. I don't yet have any ETA for when or even if this might ever become available, but if it does, we will post that information here.

If you prefer direct email notification, send an email to support@vandyke.com and include Feature Request - Forum Thread #14292 in the subject line or use this form from the support page of our website.

That all being said, the capability to substitute dynamic date/time variables into a command is possible with scripting. We've just made a script with this date/time substitution capability available on the scripting forums if you wish to try it out.
__________________
Thanks,
--Cameron

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 06:23 PM.