Using Send Unix in ARD to copy files from laptops to server--

OK, you ARD "Send Unix" gurus, here's a question. I am still getting my feet wet in the Terminal and having lots of fun, no big mistakes yet..
I am looking for a solution to make a teacher's life easier. It's a writing class. Each day the students do a writing exercise with the MacBook or iBook carts, and the students seldom have the same computer twice. The laptops are bound to Active Directory, and a local user folder is created in /Users using our naming scheme lastname.firstname, and the teacher laptop has Apple Remote Desktop Admin.
Usually, students are supposed to save their documents to their own home folders on the server, but it's kind of wonky through the menus (until we get the Xserve up and running), so they usually save first to Desktop and then drag the files to their server home folder icon on the Dock. BUT, I'd like to set it up so the teacher can get copy of the Word document each day to read and archive. Setting up another share for the students to drag it to proved unreliable, e-mail is not an option (too much processing of individual files for the teacher), and the teachers can go into the home folders when absolutely necessary if one or a few kids forget, but not all of them each day.
Here's what I'd like to do-- create a script that the teacher could run in ARD to do the following to the group of MacBooks/iBooks:
copy contents of currently logged-in user's Desktop to /Volumes/mountednetworkdrive/sharename/classfolder/ AND rename the file if there is already one there with that name, do NOT overwrite.
The students are supposed to name their files last.first.doc, but they forget, and the test scripting I've tried overwrites Document1.doc with Document1.doc from another student. Since they put their names in the document itself, it's not a big deal to the teacher if they forget to name it correctly.
The major problems -- the variable for current user "~/" as in ls ~/Desktop/ doesn't seem to list the desktop contents of the current user on the remote machine, therefore I assume cp ~/ would also not work properly.
I have also be unable to find any documentation of any of the various copy commands that talks about renaming instead of overwriting (like web browsers do if you download the same file multiple times, for example, by appending a digit).
Options: Instead of renaming, copying the logged in user's whole Desktop directory (but not whole cached login) would eliminate the need to rename, but still not as handy as all the files in one directory. Eg. "cp /Users/(last.first)/Desktop /Volumes/mountednetworkdrive/sharename/classfolder/" but we'd need the folder name of the currently logged-in user to copy, too, (confusing I know) so that the teacher would then find in server/share/class/ a bunch of folders named last.first (the student names) with another folder called Desktop and their document inside. The rudimentary script I wrote above, even if it worked, would copy the whole cached home directory, which is too large with the Library, as well as the inevitable Photo Booth pictures.
Another option would be to copy the contents of the desktop to a new folder named after the logged in user (if that variable exists).
Arg. This was supposed to be simpler, but if there is any way to make this work, I'd appreciate any ideas.
Thanks

My usernames are shorter, so I never noticed that who only has 8 characters. Just to make it more interesting, the if command further down was goofed up by the forum. The ' -e "$DEST/$FILE" ' should have square brackets where the single quotes are in this sentence.
Fixing the truncating problem is interesting, especially with the forum goofing up my if statements. I guess I'll have to try single quotes and you'll have to change them with square brackets. It's important that the square brackets be a space away from what's inside them. Dump the cd line and replace it with:
USER=$(who | grep console | awk '{ print $1 }')
DIR=$(ls -1 | grep $USER)
if ' `echo $DIR | wc -w` -gt 1 '
then
echo "FAILURE!"
exit 1
else
cd /Users/$DIR/Desktop
fi
This code will bail out if it can't find a single user directory. I doubt it will work well if the short names have spaces either. Be careful of the back-ticks in the if statement! They are significant.
Roger

Similar Messages

  • How to use HTTPS to retrieve a set of files from a distant server?

    Hi !
    i am interested in some samples or links showing how is it possible to use HTTPS in a java code in a standalone application ( could be swing based or whatever) that allows an HTTPS connection to a distant server ( specefic file repository) so that downloading some data files could be possible.i am also interested to know what conditions should be available to make such connection possible ( specefic port number? specefic authentication? login? password? and does the Operating system on the distant server interfere with that ? etc...)
    thanks!

    in fact i tried to test a sample code by i got this exception :
    Exception in thread "main" javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
         at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1591)
         at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:187)
         at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:181)
         at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:975)
         at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:123)
         at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:516)
         at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:454)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:884)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1096)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1123)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1107)
         at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:405)
         at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:166)
         at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:977)
         at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:234)
         at HTTPSConnector.main(HTTPSConnector.java:30)
    Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
         at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:285)
         at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:191)
         at sun.security.validator.Validator.validate(Validator.java:218)
         at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:126)
         at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:209)
         at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:249)
         at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:954)
         ... 12 more
    Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
         at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:174)
         at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:238)
         at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:280)
         ... 18 moreand here si the sample code:
    package foo;
    import java.net.URL;
    import java.io.*;
    import javax.net.ssl.HttpsURLConnection;
    public class Test
    public static void main(String[] args)
    throws Exception
    String httpsURL = "https://your.https.url.here/";
    URL myurl = new URL(httpsURL);
    HttpsURLConnection con = (HttpsURLConnection)myurl.openConnection();
    InputStream ins = con.getInputStream();
    InputStreamReader isr=new InputStreamReader(ins);
    BufferedReader in =new BufferedReader(isr);
    String inputLine;
    while ((inputLine = in.readLine()) != null)
    System.out.println(inputLine);
    in.close();
    }so what this error is due to? and how to fix it ?.
    thanks!

  • Using ARD to copy files remotely?

    Hi,
    I was thinking it is possible to use ARD to copy files from my home imac, when I am in the office using my macbook? Or this can only be done when I am on the same network? Thanks in advance.

    Should work fine provided you have ARD fully working between the two sites.

  • Can't copy file from SAP-directory to FTP server

    Hello,
    I can't copy files from the SAP server to the FTP server. The file is created with OPEN DATASET and CLOSE DATASET commands and is placed in the SAP-directory S:\usr\sap\DEV\DVEBMBGS00\work.
    I can see and read the file with transaction al11, so I know it's there.
    But the FTP command always gives the same error:
    S:\usr\sap\DEV\DVEBMBGS00\work\[FILENAME] errno 22: invalid argument
    I can connect to the FTP, but the put command keeps failing. Somehow, the file in the SAP directory can't be read, it seems, even when
    Any ideas?
    Thanks in advance.
    Dave

    Ok, I found out that I have to use SAPFTPA as RFC destination type, instead of SAPFTP, otherwise the folders can't be located.
    But with SAPFTPA I can't seem to connect to the FTP server. I've tested the connection with sm59 and it works, but for the FTP it doesn't work. When I use SAPFTP as destination type, it still works.
    What can I do?
    Thanks.

  • Copying Files From a Remote Machine through "rcp" command not working.

    Hi All,
    I'm a new comer to this famous forum. I was trying to go through the PDF "Solaris Advanced User's Guide" .So in chapter 9-"Using the network" i came across "Copying Files From a Remote Machine". And the syntax was "rcp machinename:source destination" . And i got another note. It is like
    "The rcp command enables you to copy files from one machine to another. This command uses the remote machine's /etc/hosts.equiv and /etc/passwd files to determine whether you have unchallenged access privileges. The syntax for rcp is similar to the command syntax for cp.".
    But i maintained remote machine's IP address in my system's /etc/hosts file. But still i am unable to do the rcp from remote system to my system or vice versa.
    Always i am getting error message " **Connection refused**".
    Therefore please some one guide me how to perform the " Copying Files From a Remote Machine" through rcp command.
    Reghards
    Kartik

    Hi
    The inconvenience of using scp is that you have to type the password every time you stablish a connection. You can work around this, adding a key into the remote hosts_allow file. This implies in more maintenance.
    From the rcp man page:
    +rcp does not prompt for passwords. It either  uses  Kerberos authentication which is enabled through command-line options or your current local user name must exist on  hostname  and allow remote command execution by rsh(1).+
    From the rsh man page:
    + If you omit command, instead of executing a single command, rsh logs you in on the remote host using rlogin(1).+
    By default, rlogin is disabled on Solaris 10
    [SunOS 5.10/bash] root@wgtsinf01:/store/sun/operating-systems
    # svcs -a|grep -i rlog
    disabled       May_11   svc:/network/login:rloginSo, to use rcp you have to enable the rlogin service and set up all the configuration files. Particularly, as already suggested, I too suggest you to use scp. :)
    Cheers
    -- Andreas
    Edited by: Bank_Of_New_Zealand on 15/06/2009 13:09

  • Cannot copy files from my work Mac to my PowerBook at home using ARD 3.1

    I'm having an issue copying files from my work Mac to my PowerBook at home using ARD 3.1. Both machines are running OS 10.4.10 and have all of the available updates have been applied. When I connect to the Mac at work using ARD, I can see everything without any problems. However, when I attempt to copy a file onto my PowerBook desktop, I lose my connection to it and ARD tries to re-establish a connection and just keep looping. I'm stumped as to why this keeps happening. When I try the above from work using my PowerBook, there are no problems. Could this problem be related to my DSL Carrier (Verizon). Anyone have any ideas? Any help or suggestions would be greatly appreciated.

    Hi Jeff thanks for that, the only problem is I cant update any of the system software at work
    And I cant just copy the folders over and use my iPod as a hard drive to take them home and put them on my iTunes as the file names on some tracks are to long

  • How can i copy files from one external hard disk to another using macbook pro with retina display

    How can i copy files from one external hard drive to another using macbook pro with retina display?

    That's odd - if you open Disk Utility (Applications->Utilities) and select the disk(s), how are they formatted? If you're only going to be used with your Mac, they should be formatted as "Mac OS Extended (Journaled)".
    Clinton

  • Cannot copy files from CD or DVD using Finder.

    Hi,
    I cannot copy files and folders from a CD or DVD to my home folder or any folder therein using Finder. I just get the "Not Permitted" symbol next to the mouse pointer when I try to drag a folder out of the CD (or DVD) to my home folder.
    I have checked that I have sufficient permissions to perform this operation and when I copy files from the CD or DVD using the command line, it works without any hassles.
    This is extremely strange and I cannot think of why it should happen.
    A solution would be most welcome as I would prefer not to have to drop into a command line when I have to copy files from CDs or DVDs.
    Regards,
    Apurva
    Apple iBook G4   Mac OS X (10.4)  

    I am experiencing the same problem: after undoing a copy in the Finder from my CD-drive to my Seagate 200GB FW-drive, I am no longer able to copy single files in the Finder from other drives than my harddisk. I can copy from my hard disk to my external harddisk, I can move and copy files within the harddisk, but I cannot copy from my external hard drive or my CD/DVD-drive to my harddisk or from my CD/DVD-drive to my external hard drive or the internal harddisk.
    What is increasingly weird, is that I can easily copy two or more files using drag and drop! I also get a nice green + sometimes when trying to move the files, but there is just no response.
    I have tried the following:
    0) rebooted.
    1) rm com.apple.finder.plist + killall -9 Finder
    2) done that in the finder using cmd-alt-esc to kill the finder.
    3) removed cache files using Yasu from http://jimmitchelldesigns.com/yasu.html, including rebooting
    4) Doublechecked permissions, including locked bits
    5) run periodic everything from the Terminal
    6) repaired permissions
    7) checked the hard disk using disk utility
    8) Logged in as another admin user to no avail.
    I can use the Terminal to copy the files without any problems, and I can open files in other applications and save them where ever from there, but the Finder refuses to let me.
    May Gods wrath kill the Finder for good! I certainly hope 10.5 will show a new Finder!

  • Cannot copy files from my network using finder

    If I try to copy files from my NAS or my PC to my Macmini running Leopard, I cannot copy files that are larger than 64kb. Otherwise I get an error message. Interestingly, if I use the cp command in the console instead, he can copy the file, but the file is corrupt in the sense that it is smaller than the original and not working. Weirdest thing is that I can access the same files from itunes or iphoto or vlc or whatever. Any ideas?

    After the update I cannot connect to my router anymore
    (see other threat)

  • Copy file from local system to Azure VM using powershell

    Hi
    Is there a simple powershell command to copy a small file from local computer to Azure VM. Point to Site is not an option for me.
    I am hoping for something simple like
    Copy-Item C:\Wabash\Logfiles\trasfer.txt -Destination C:\Presentation -ConnectionUri $uri -Credential $credential
    similar to Invoke-Command
    The only other option i have seen is 
    http://www.mattwrock.com/blog/copy-files-from-local-computer-to-an-azure-vm
    which i fell for my purpose is over kill.

    Hi,
    I will mark Ed's post as answer, if you fount that doesn't give you help, please feel free unmark it and follow up with more information.
    Best Regards,
    Jambor
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to copy files from a color classic w/broken floppy drive to an i-book ?

    How to copy files from a color classic w/broken floppy drive to an i-book ?
    I have a Coplor Classic with a system 7.
    There is no ethernet on color classic. The floppy drive is dead.
    I need some important files I have on the color classic...
    How do I connetct them to transfer files?...

    The easiest way, as AppleIIFreak has suggested, is probably to find another older Macintosh computer (with the round MiniDIN printer port) to be used as an intermediary. You could then connect the two machines by means of LocalTalk cabling, or just a plain Mac serial printer cable between the printer ports, and then set up file sharing. From that other Mac, you should be able to forward the files via Ethernet, diskettes (if you have an external USB floppy drive for the iBook) or email (Internet).
    If a second old Mac is not available, you may want to try something else. It would not be unusual for a Color Classic to have ClarisWorks already (obviously, one cannot expect anything new to become installed). If so, that program suite would contain a communications part. This means that you could connect an external serial modem, and send the files over the phone lines (or locally, modem-to-modem, in principle as in KB article # 22229; sometimes a very simple home-built line simulator may have to be added) to any other computer using a terminal emulation application with file transfer capabilities. It would also be possible to connect the modem port directly to the serial port of a PC, through a combination of a Mac modem cable (MiniDIN-8M to DB-25M) and a standard PC null-modem cable (DB-25F to DB-9F).
    Jan

  • Error -36 when attempting to copy files from an FTP

    I recently got a new macbook pro, but am having trouble retrieving files from an FTP server I used to use with my old iMac with no problems. Whenever I try to copy the files from the FTP to my computer, I get Error Code -36 about being unable to write the files. I know it's not a problem with the FTP server because I was able to retrieve the files with a computer running Windows. Any idea how to fix this problem? I have it when using CuteFTP as well as the standard Mac FTP access through Finder.

    Try the Unix forum under OS X Technologies. Additionally, use the built in ftp command.

  • Why when  i copy files from downloads to a new folder,then i delete them from the downloads i will loose the file?

    tell me please when i copy files from downloads  it will be a new file with new capacity? i mean if a file is 2 mb, when i copy it it will be new 2mb ?

    If you copy it to another folder, e.g., Documents, and you can see it in the Downloads folder then you now have two copies of the file. If you delete one copy, the other stays intact. If you keep both, there is no harm, although the amount of disk space used is twice as big as when you only keep one copy.

  • Why cant i copy file from my macbook to my portable harddrive?

    i just bought a new macbook. i'm kinda newbie. i tried copying file from my macbook to portable harddive. it didnt work. can anyone tell me why? by the way, my harddrive is NTFS system. the funny thing is that i can copy file from my harddrive to my macbook.
    thanks for the kind soul out there.
    mac book Mac OS X (10.4.9)

    The easiest way around this is to reformat the external drive to be FAT32 if you want to use it with other PCs, or HFS+ if you only want to use it with Macs. You will lose all the data off the drive when you do this.
    You can reformat the drive using Disk Utility.

  • Unable to Copy File From Terminal Server to Client Share

    Hi
    For years client have been able to copy files from our Windows 2003 Terminal Server to their local workstation using:
    copy myfile \\tsclient\mydrive\myfolder
    However we upgraded to Windows 2012 Server R2 and now Windows 7 Pro clients cannot copy files.  The copy function creates the file name in their local folder but no content is sent after maybe 20 minutes or so the copy function times out and they get an
    error message saying that the application was unable to write to the file.  I have tried this function with my Windows 8.1 workstation and the file copies properly and it works fine for older Windows XP clients.  Does anyone know why Windows 7 clients
    are experiencing this issue.
    Thanks
    Simon

    Hi Simon,
    Initially please use latest RDP version 8.1 for windows 7 and check result. 
    What’s the file size which you are copying?
    Does this happens for all users and on all computers?
    You can try below method might resolve your case.
    1. Login to remote computer using Remote Desktop (RDP). 
    2. Open Task Manager in the remote machine
    3. Click the "Process" tab
    4. Locate a program called "rdpclip.exe"
    5. Right click and select "End process" to kill this program
    6. Click on "File" menu in the task manager and select "New Task (Run)"
    7. Type rdpclip.exe and press the button to start the process.
    By killing existing instance of the rdpclip.exe and restarting the program, you can get your copy paste work again in your remote desktop.
    Hope it helps!
    Thanks.
    Dharmesh Solanki
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

Maybe you are looking for

  • HT4623 how can i create an apple ID  account without a credit card???

    how can i create an apple ID account without a credit card?

  • PDF memory leak

    opening the following URL and scrolling down to the graphic in section 4.3 causes Safari 4 to consume all RAM and then crash. http://delivery.acm.org/10.1145/1370000/1364038/p1498-park.pdf?key1=1364038&key2 =4311574421&coll=GUIDE&dl=GUIDE&CFID=389845

  • Private constructor documented as public by javadoc

    I'm generating document for a class similar to the following: public class Example { public static final Example TYPE1 = new Example(); public static final Example TYPE2 = new Example(); private Example() { // private constructor When I run the Javad

  • Inquiry

    Hi Guys actually Im not developer but I like to suggest something so that either one of you guys can diliver it to apple software developing division or can provide me with link or email for sending my suggestion I have macbook pro 15", 2.0 GHz, earl

  • How can I locate a Deal ID from a CCW Quote ID?

    If I have CCW Quote ID, can I locate a Deal ID associated with it?