473,378 Members | 1,395 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

FTP from Window machine to Linux machine the List of Files having C++ changes

Hi All,

I have changed my C++ code in Source Insight Editor and I wanted this code should FTP to Linux Machine through Script but not manually.
Can anyone have knowledge of how to FTP the code through Script.
FTP from Window machine to Linux machine the List of Files having C++ changes


Thanks & Regards
Shashi Singh
May 26 '15 #1
1 2289
RonB
589 Expert Mod 512MB
There are several different modules on CPAN that can handle FTP.

Here's a working example I posted a couple weeks ago on another forum. It requires 2 separate modules 1) Net::FTP::Foreign and Net::SSH2.

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
  2.  
  3. use warnings;
  4. use strict;
  5. use Net::SFTP::Foreign;
  6. use Data::Dumper;
  7.  
  8. my $host = '10.100.0.118';
  9. my $sftp = Net::SFTP::Foreign->new($host,
  10.                                    backend => 'Net_SSH2',
  11.                                    user => 'me',
  12.                                    password => 'mypass');
  13. $sftp->die_on_error("Unable to establish SFTP connection");
  14. $sftp->setcwd('/home') or die "unable to change cwd: " . $sftp->error;
  15.  
  16. my @files = $sftp->ls('.');
  17. print Dumper \@files;
Output Results:
Expand|Select|Wrap|Line Numbers
  1. c:\test>ftp_test.pl
  2. $VAR1 = [
  3.           [
  4.             {
  5.               'a' => bless( {
  6.                               'mtime' => 1361376188,
  7.                               'atime' => 1431030184,
  8.                               'perm' => 16877,
  9.                               'flags' => 15,
  10.                               'size' => 4096,
  11.                               'uid' => 0,
  12.                               'gid' => 0
  13.                             }, 'Net::SFTP::Foreign::Attributes' ),
  14.               'filename' => '.',
  15.               'longname' => 'drwxr-xr-x    3 root     root         4096 Feb 20  2013 .'
  16.             },
  17.             {
  18.               'filename' => '..',
  19.               'longname' => 'drwxr-xr-x   24 root     root         4096 May  6 08:59 ..',
  20.               'a' => bless( {
  21.                               'gid' => 0,
  22.                               'uid' => 0,
  23.                               'flags' => 15,
  24.                               'size' => 4096,
  25.                               'atime' => 1431024163,
  26.                               'perm' => 16877,
  27.                               'mtime' => 1430927972
  28.                             }, 'Net::SFTP::Foreign::Attributes' )
  29.             },
  30.             {
  31.               'filename' => 'rkb',
  32.               'longname' => 'drwx--x--x   63 rkb      rkb         12288 May  7 08:54 rkb',
  33.               'a' => bless( {
  34.                               'mtime' => 1431014091,
  35.                               'perm' => 16841,
  36.                               'atime' => 1431017837,
  37.                               'flags' => 15,
  38.                               'size' => 12288,
  39.                               'uid' => 500,
  40.                               'gid' => 500
  41.                             }, 'Net::SFTP::Foreign::Attributes' )
  42.             }
  43.           ]
  44.         ];
  45.  
May 26 '15 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: m|sf|t | last post by:
All, Recently our TiVos were upgraded to include a webserver. Is it possible for me to run a PHP script from my machine and have it somehow retrieve a listing of all the files in subdirectory that...
0
by: Naeem | last post by:
i want to transfer a huge amount of data which is maintained over windows running PHPTriad. PHPTriad can dump data and schema/structure into a text file. now i want to transfer this data to Red...
3
by: Hamed | last post by:
Dear Folks I am programming a page that asks user a directory name and lists files of type *.xls in the directory in client's machine. He/She will then select some files to upload them to the...
8
by: RML | last post by:
hey guys, i am looking at this piece of code that lists numbers of files in a directory. i want to convert it so it lists the files in th directory that end with .doc. i cant seem to get it to...
20
by: Ramdas | last post by:
How do I add users using Python scripts on a Linux machine? Someone has a script?
1
by: mmohanra | last post by:
I am trying to list files in a folder in a remote server. I am using Scripting.FileSystemObject. This seems to be really slow. After a long time the connection times out. Is there any other way to...
3
Banfa
by: Banfa | last post by:
So the title pretty much says it. I am attempting to switch to Linux but the printer attached to my machine must still be accessible by my wife who uses Windows. Alternatively attaching the...
9
by: tvnaidu | last post by:
When I do ssh to LINUX machine from windows using ssh client, first time it will display certificate, then it will ask y / n?. Where it will keep that certificate on windows machine?. any idea what...
3
by: tvnaidu | last post by:
running minicom to access serial port usinh putty to Linux machine, minicom windpw is small and fixed, can't change size, any idea?
4
by: tur130 | last post by:
I have a whole bunch of files called xxx_Page1.htm at a domain, where xxx is a type of animal. I have a script that iterates through a known list of animals setting MyVar for each one. The...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.