VanDyke Software Forums

Go Back   VanDyke Software Forums > File Transfer
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
  #1  
Old 03-26-2012, 04:32 AM
Raina Raina is offline
Registered User
 
Join Date: Mar 2012
Posts: 4
Post Script for deleting old files

Hi,
I have Windows Server 2003 on my local.
i have Vandyke Client Pack and I am connecting to SFTP site using :
vsftp -b D:\DeleteOldFiles.txt --auth publickey -i "C:\Program Files\VanDyke Software\Key" FirstUser@sftp.XXXX.com

I wish to write DeleteOldFiles.txt in way.. it should delete files older than 90 days from a folder on SFTP site.

I have been using "ForFiles" command when dealing with local directories.
When I try the same after connecting to SFTP site, "ForFiles" is an invalid command.

I know, one needs to have ForFiles.exe in Windows/System32 folder, how can I install it on SFTP side?
Is there any other tool packaged along with Vandyke Client Pack which can provide me same functionality?

Hope you can help.
Reply With Quote
  #2  
Old 03-26-2012, 08:18 AM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 3,265
Hi Raina,

Thanks for the question. The vsftp command-line client doesn't currently have a way to delete files based on age.

If you want to use ForFiles on the remote, you would need to use vsh with a shell connection rather than vsftp.

What you may want to consider doing is using VRALib. It is a COM object that allows SFTP functionality to be incorporated into a script or program that you write. It may be easier to get and parse the necessary data to accomplish your goal using VRALib rather than vsftp.

If you want to use vsftp to accomplish the goal, you could use a script to get a file listing using vsftp, and log the data. The script could then read in the data and parse it for file age. Then you could write a batch file to delete the files that are 90 days old. Finally, the script could issue another vsftp command to run the batch file to delete the old files.

Does this help to answer your question?

As a note, I have created a feature request in our ClientPack enhancement database to add this type of functionality. Should a future release of vsftp have the ability to delete files that are older than a certain date, we will post to this forum thread.

If you would like to be notified directly, please complete and submit the form at the following location:
Submit Feature Request
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
Reply With Quote
  #3  
Old 03-27-2012, 05:22 AM
Raina Raina is offline
Registered User
 
Join Date: Mar 2012
Posts: 4
Thumbs up VRALib works well..

Hey Todd..
I switched to VRALib. And it works for me.



Thanks a lot!
Reply With Quote
  #4  
Old 03-27-2012, 08:22 AM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 3,265
Excellent news Raina!

I am glad to hear that you were able to accomplish your goal using VRALib.

If you have any questions as you continue to use VRALib, please let us know.
__________________
--Todd

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

Tags
delete old files, forfiles


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 -7. The time now is 02:26 AM.


copyright 1995-2014 VanDyke Software, Inc.