- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Perl script for FTP file transfer...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-17-2007 12:37 AM
тАО04-17-2007 12:37 AM
Perl script for FTP file transfer...
so i need a perl/unix script to perform this task.....can you help me doing that???
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-17-2007 01:26 AM
тАО04-17-2007 01:26 AM
Re: Perl script for FTP file transfer...
ftp -vin <
quote USER
quote PASS
put
quit
END_SCRIPT
) | grep "226 Transfer complete." > /tmp/ftp$SRCFILE
if [[ -s /tmp/ftp$SRCFILE ]]
then
echo "FTP Completed Sucessfully"
mv
EXTSTA=0
else
echo "FTP Failed"
EXTSTA=1
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-17-2007 02:09 AM
тАО04-17-2007 02:09 AM
Re: Perl script for FTP file transfer...
actually i need this in perl...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-17-2007 02:10 AM
тАО04-17-2007 02:10 AM
Re: Perl script for FTP file transfer...
-------------------------------------------
#!/usr/bin/sh
typeset SRCDIR="/aaa/bbb/my folder"
typeset DESTDIR="/xxx/yyy/his folder"
typeset BACKUP_DIR="backup_machine1"
typeset REMHOST="machB"
typeset USER="mickey"
typeset PASSWD="secret"
typeset -i STAT=0
cd "${SRCDIR}"
STAT=${?}
if [[ ${STAT} -ne 0 ]]
then
echo "Can't cd to ${SRCDIR}" >&2
exit ${STAT}
fi
ftpput.pl -h ${REMHOST} -l ${USER} -p ${PASSWD} -d "${DESTDIR}" -B *
STAT=${?}
if [[ ${STAT} -eq 0 ]]
then
mv * "${BACKUP_DIR}/"
STAT=${?}
echo "mv failed; status ${STAT}." >&2
else
echo "FTP failed; status ${STAT}." >&2
fi
exit ${STAT}
-------------------------------------------
If you create a .netrc file you will not need to pass the password parameter.
The perl script ftpput.pl is attached; invoke as "ftpput.pl -u" for full usage. The Perl script does full error checking.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-17-2007 04:27 PM
тАО04-17-2007 04:27 PM
Re: Perl script for FTP file transfer...
i want to transfer files from a folder ,ie,"c:/my folder/my files" in my machine to another one through ftp and after transferring i want to take a backup of the file in "c:/backup/my backup".....like this only...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-17-2007 08:59 PM
тАО04-17-2007 08:59 PM
Re: Perl script for FTP file transfer...
use Net::FTP;
$ftp = Net::FTP->new("some.host.name", Debug => 0)
or die "Cannot connect to some.host.name: $@";
$ftp->login("anonymous",'-anonymous@')
or die "Cannot login ", $ftp->message;
$ftp->cwd("/pub")
or die "Cannot change working directory ", $ftp->message;
$ftp->put("that.file")
or die "get failed ", $ftp->message;
$ftp->quit;
You should then be able to move files about with
$curlocation = "file1.txt";
$newlocation = "saved/filebackup.txt";
move($oldlocation, $newlocation);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-17-2007 09:42 PM
тАО04-17-2007 09:42 PM
Re: Perl script for FTP file transfer...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-17-2007 11:22 PM
тАО04-17-2007 11:22 PM
Re: Perl script for FTP file transfer...
(and straight from the help text :-)
Read the example code carefully again.
If you can not figure out where a variable with the host name should go, then you should find help performing this particular job, or consider setting up a samba or nfs share to allow you to drag and drop the files.
Check the help page for the perl ftp module: google: ftp perl
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-18-2007 02:20 AM
тАО04-18-2007 02:20 AM