Go Back   The macosxhints Forums > Working with OS X > OS X Developer



Reply
 
Thread Tools Rate Thread Display Modes
Old 08-07-2004, 12:13 PM   #1
freaky
Prospect
 
Join Date: Jun 2004
Posts: 25
Example of how to upload a file using shell?

Is using "do shell script" and cURL really a better way to upload a file than URL Access Scripting? If so, can somebody give me a simple example of how to upload a small text file with this method?
__________________
15" PowerBook (Aluminum)
1 GHz PowerPC G4
256 MB DDR SDRAM
60 GB Ultra ATA/100
Airport Extreme Card
Mac OS X v10.3 Panther

15" iMac (Graphite)
600 MHz PowerPC G3
512 MB SDRAM
120 GB Western Digital Caviar
Mac OS X v10.3 Panther
freaky is offline   Reply With Quote
Old 08-07-2004, 03:19 PM   #2
B-Zero
Triple-A Player
 
Join Date: Aug 2004
Location: Toronto
Posts: 76
Not sure about cURL, but for stuff like this, I usually end up using ncftp.
B-Zero is offline   Reply With Quote
Old 08-19-2004, 10:06 PM   #3
Newbish
Triple-A Player
 
Join Date: Nov 2002
Location: Massachusetts
Posts: 202
scp?

Probably not the best suggestion for this if you're batch moving a bunch of files, but when I want to move one or two files quickly between machines via the internet, I use the secure scp command:

scp filename username@target_domain.com:filename

You'll be prompted for your username and password for your target. If you need to copy a whole bunch of files, put them in the same directory, and then copy the directory with the -r flag set. (man scp, to learn more)

Hope that helps some.
__________________
There is no such thing as a stupid question. If you don't ask, you will never know.
Newbish is offline   Reply With Quote
Old 08-19-2004, 10:19 PM   #4
vancenase
All Star
 
Join Date: Apr 2003
Location: OH
Posts: 934
interesting .. i didn't know about the -r flag for scp. i've been using rsync.

on that note, anyone know what's quickest? 'rsync' or 'scp -r' for copying an extremely large directory (1-10GB+)? perhaps i'll do a test tomorrow if time allows
vancenase is offline   Reply With Quote
Old 08-19-2004, 10:29 PM   #5
kfaulhaber
Major Leaguer
 
Join Date: Dec 2002
Posts: 291
If it is a one time transfer with no exclusions, then I would say they are about the same. However, if you will be doing updates or want to exclude parts of the subdirectory, rsync is your friend.
kfaulhaber is offline   Reply With Quote
Old 08-20-2004, 07:59 AM   #6
Newbish
Triple-A Player
 
Join Date: Nov 2002
Location: Massachusetts
Posts: 202
One caveat to be aware of:

cp -- and I think it safe to assume scp, too -- will strip the resource forks from Mac files. Being a core UNIX command, cp simply doesn't know how to handle resource forks. So any custom icons or data in resource forks will be lost. I learned this as a trick to strip the resource-fork from jpegs before sending them to friends with Windows-based computers (no longer needed due to improvements in Mail.app).

But if you use Stuffit to put your files in .sit or .sitx archives, and then copy the SIT/SITX file, you can safely move your files without losing the resource forks.

Just something to be aware of if the resource forks are important to you.
__________________
There is no such thing as a stupid question. If you don't ask, you will never know.
Newbish is offline   Reply With Quote
Old 08-20-2004, 09:52 AM   #7
kfaulhaber
Major Leaguer
 
Join Date: Dec 2002
Posts: 291
Quote:
Originally Posted by Newbish
cp -- and I think it safe to assume scp, too -- will strip the resource forks from Mac files.

This goes for rsync as well. However, there are HFS friendly versions of both rsync and cp. (rsyncX an CpMac)
kfaulhaber is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 -5. The time now is 05:59 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.