Pragma Systems




Directory removal with today's date?

Expand / Collapse
Author Message
 Posted 2/8/2012 12:10:23 PM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 4/23/2012 3:12:00 PM
Posts: 10, Visits: 29
I am trying to create a date variable that returns the  4digit year, 2digit month, and 2digit day (ex 20120208) , similar to dos ( Fdate=%date:~10,4%%date:~4,2%%date:~7,2%) to be used in an SFTP command.  SFTP will be used to remove all files and directories in a date folder (ex 20120208).  Is there any way to accomplish this using pragma SFTP?

ex. rm c:/%Fdate%

ex. rmdir c:/%Fdate%
Post #162
Add to Twitter Add to Facebook
 Posted 2/8/2012 6:50:02 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 3/14/2012 10:06:49 PM
Posts: 4, Visits: 12
SFTP does not have script variable expansion feature. You can use ssh shell access to run a batch command which embeds the date script variable to craete the dated file to be deleted.

Possible example forms are:

ssh remotemachine "cmd /c deltree -F %Fdate%"

For more complex scripts, put it in mydelete.cmd and invoke it remotely.

ssh remotemachine mydelete.cmd
Post #164
Add to Twitter Add to Facebook


Similar Topics

Expand / Collapse

Reading This Topic

Expand / Collapse