Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Copy bookmarks

by scottstef (Curate)
on Mar 12, 2001 at 08:28 UTC ( [id://63740]=CUFP: print w/replies, xml ) Need Help??

This little script is used to copy my Netscape Navigator bookmark.htm file from my laptop running NT to my bsd box at home.
There are two problems with it:
1: I need to set it up so I can pipe in a file of different machine names so it will update all of my machines.
2: I need to tweak it so it will do some sort of file globbing. Right now the only way I can make it work is to put it in the same directory as the bookmarks file. (I couln't figure out how to get the absolute path (Program Files/Netscape/Users/default as the path) Any ideas on what would be the best way to get the program files directory name? Would a glob be best?

Answer to number 2- bad scotstef! bad scotstef! Did a perl monks search on dos file spaces and i think vroom had posted this a year ago. WOW rtfm worked. Sorry I should have done that earlier.
Answer to number 1- will work on it, just need to test which boxes i want to send to.

#!/usr/bin/perl -w use strict; use Net::FTP; #Written by Scott for the purpose of saving having #to manually copy over my bookmarks file from my laptop. #variables to define the server, username, #password, local bookmarks file, remote bookmarks file, #and the "ftp object"? my $server="hostname.com"; my $username="username"; my $password="password"; my $file= "c:\\Program Files\\Netscape\\Users\\default\\bookmark.htm"; my $bookmarks="/home/scott/.netscape/bookmarks.html"; my $ftp; #Create the connection $ftp=Net::FTP->new($server); #print statement- always like a lort of these so i know something #happenned, is happening etc print "Trying to log in\n"; #log in or Die- tells me i was unable to log in $ftp->login($username, $password) || die "Unable to log in: $!"; #see comment on print statements for below. print"Succesful log in\n"; #actually starting the xfer through a put statement putting local file +s over to #remote file name #Use Die to let me know i screwed up the xfer $ftp->put($file, $bookmarks) || die "Unable to upadate files"; #Quit nicely, or Die and quit forcefully $ftp->quit() || die "Unable to quit $!";

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: CUFP [id://63740]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-25 11:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found