Solved

ftp file copy dos batch script or VB6  code needed

Posted on 2010-08-30
7
688 Views
Last Modified: 2012-05-10
I appreciate if someone can give me some sample code that will do the following.

Platform: windows 2003 server
1. log in to ftp
2. moves to a diffrent directory in the ftp
3. Moves all files to a local drive
   ( I want some code that loops through all the files  -  and also waits till all files are moved)
6. Log off ftp session

I beive I can pretty much do the logon logoff, bits but the copy files and the wait loops are the ones that I am not sure of.

Thanks.

0
Comment
Question by:indikad
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 3

Assisted Solution

by:saL1Las
saL1Las earned 50 total points
ID: 33564746
I would not recommend doing loops. Instead I'd say make it simple:

login
cd local directory (C:\..)
cd remote directory
get entire folder
cd local directory to also remote directory
delete the original file <-- this gets you the effect of moving the file.
log off
0
 
LVL 11

Expert Comment

by:kbirecki
ID: 33566362
Manually writing the FTP commands in vb6 may be reinventing the wheel.  If you don't necessarily have to do it in VB6, try an existing app that has scripting, like WinSCP (http://winscp.net/eng/docs/scripting) or many others.  Here's another thread about this same topic: http://www.tek-tips.com/viewthread.cfm?qid=1231250&page=8

I actually have to do something similar for myself, so when I get it working, I'll post back my results.

0
 
LVL 11

Expert Comment

by:kbirecki
ID: 33566407
I just found this reference to using WinSCP to sync a local folder with an remote folder:  http://winscp.net/eng/docs/script_commands#synchronize

That looks like it would work.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:indikad
ID: 33573322
can  or someone give me some sample code pls ?
0
 
LVL 11

Accepted Solution

by:
kbirecki earned 450 total points
ID: 33574385
Sure.  I'll be happy to connect the dots.  I haven't had a chance to put this into action for myself, but in my case, now that I found that WinSCP has good scripting capabilities and documentation, seeing the information I pointed out in an earlier post about the "synchronize" command (http://winscp.net/eng/docs/script_commands#synchronize), and knowing I'm not likely the first person to discover this, I Googled "winscp synchronize local".  I immediately found two excellent examples that I think are what you are looking for.  (I don't think it's necesary for me to copy and paste their code here, since they should get the attribution and credit for their efforts.)  Take a look at these two links:

http://jonkruger.com/blog/2008/05/23/how-to-automatically-back-up-your-personal-files/

...and...

http://gerardnico.com/wiki/backup/backup_with_winscp

Is that helpful?
0
 
LVL 11

Expert Comment

by:kbirecki
ID: 33574407
I also should have mentioned that the first example is to backup from local to remote, and the second example is to backup from remote to local.
0
 

Author Closing Comment

by:indikad
ID: 33575672
Thank you very much.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question