ROBOCOPY Copying directory from remote computer: error 'the network path was not found'

4

1

I am trying to copy a folder from a remote computer using ROBOCOPY

I'm using the following:

NET USE \\192.168.10.90\IPC$ /u:server\[username] [password]

ROBOCOPY \\192.168.10.90\home\lgr\ \\C:\LGR_Back_Up\LGR_A\ /Z

NET USE \\192.168.10.90\IPC$ /D

If I run this line by line, I get 'The command completed successfully'after the first line, followed by 'The network path was not found' after I enter the Robocopy commmand.

I think this is because I am in the wrong location.

When I log into the computer 192.168.10.90, using SSH, I get logged into the user's folder with the username I specified. This folder is contained withing the home directory, so the path is home/user. Where I want to copy files from is home/lgr/.

Is it possible that once I log in from the command line with my first line of script, that I am taken to the user folder, so that my script is looking for the folder home/user/lgr/? If so, how do I navigate up one level?

I hope this makes sense.

Robert Holden

Posted 2014-03-10T13:10:21.073

Reputation: 85

a few questions to get a clearer idea of your situation: After your first net use command, what do you see if you point an explorer to \192.168.10.90 or to \192.168.10.90\IPC$ ? The single backslashes seem suspicious, just a typo in the question? – TheUser1024 – 2014-03-10T13:27:58.803

A network share cannot be the working directory of cmd.exe. Still, I believe your problem lies elsewhere. – Daniel B – 2014-03-10T13:33:36.407

Answers

1

\\C:\LGR_Back_Up\LGR_A\ is not a valid network path.

If LGR_Backup is on the local drive, then use C:\LGR_Back_Up\LGR_A\.

If LGR_Backup is a folder in the root of C: on a remote computer, and you're trying to get at it via the C$ admin share, then you'd use \\Remote_Computer\C$\LGR_Back_Up\LGR_A\

Ƭᴇcʜιᴇ007

Posted 2014-03-10T13:10:21.073

Reputation: 103 763

Shouldn't that last \\C$\LGR_Back_Up\LGR_A\ be \\remote_computer\C$\LGR_Back_Up\LGR_A\ (with the location of the remote computer after \\)? Anyway, i think he wants ROBOCOPY \\192.168.10.90\C$\home\lgr\ C:\LGR_Back_Up\LGR_A\ /Z (if the whole C-drive is correctly shared). – Rik – 2014-03-10T14:41:06.873

@Rik Whoops, yes. :) – Ƭᴇcʜιᴇ007 – 2014-03-10T14:42:52.023

Thanks for your help. I got it working. Can post how I did it if anyone is interested? – Robert Holden – 2014-04-15T11:26:40.850

1

In the end this is the script that I got to work:

rem # Script to connect:

NET USE \\192.168.10.90\IPC$

rem # Script to copy:

ROBOCOPY \192.168.10.90\lgrdata\ \ICOS\Analyser_backups\LGR_Flux\ /NP /TEE /E /dcopy:T /Z 

rem # Script to disconnect:

NET USE \\192.168.10.90\IPC$ /D

Thanks for all your help. I think this was a complicated, specific problem due to the folder structure of our instrument. I just couldn't figure out where the data was that I wanted to copy, and then I also problems using the following from the original script:

\\C:\LGR_Back_Up\LGR_A\ /Z

As Techie007 said, this is not a valid network path.

Robert Holden

Posted 2014-03-10T13:10:21.073

Reputation: 85

0

OK, you missed some of the net use command

[left out drive letter to attach network storage to]

Quick Guide

1> Net use X: \\server DNS or IP\Network.Share\to\connect\to\specified\drive\letter /user:serverDNS*(note 1)\username password*(note2)

2> Robocopy X: [or specified drive letter]\*.* C:\location\of\backup\directory [don't forget to create directory with mkdir beforehand

3> net use X: /del /y [disconnects share without confirmation question]

(note 1) use ip if needed but that can get hairy here usually needs either Winbind name or DNS which ARE DIFFERENT google enable winbind ubuntu (or your flavor of Linux) it is super easy to do most of the time. I have used either the FQDN as well as the winbind name interchangeably but IP in user part of command almost always fails.

(note 2): For security leave password off your script would stop and ask you for password after it runs the net use command and it connects and then once you enter it and hit the enter key it will continue with script. This does not have you leaving your password in a plaintext script file for more security, but sometimes you need to have script not stop [ie logon scripts]

Also I think you may be going about this odd ways [it works just requires more settings and effort than a VPN]. If it was me from a windows client to a *nix host I would recommend a using a VPN server like OpenVPN then you could use the bridged setup and become just another client on the network [with SSH you are connected to the server directly and would need to setup port forwarding through SSH to get services to pass through to your physical client directly], but forget that for a minute you don't seem to have net use running correctly, so if that works then read on and using your current setup should work

Net use is for setting a drive letter try: NET USE X: [OR ANY DRIVE LETTER NOT USED] \\192.168.10.90\home\lgr /user:server[username] [password]

you can run net use in all lower if you wish Windows does not care about case like Linux or Unix or Mac OS X btw

BUT BE WARNED YOU DO NOT WANT TO MESS WITH IPC$ IT IS HIDDEN FOR A GOOD REASON IT HANDLES ALL COMMUNICATIONS BETWEEN ALL APPLICATIONS ON A WINDOWS MACHINE [AND ALL NETWORK TRANSACTIONS] BACK IN THE DAYS OF NT 4 I GOT BORED AND DELETED IPC$ SHARES OF PEOPLE WHO ANNOYED ME WHY? YOU LOSE ALL AND I MEAN ALL NETWORK COMMUNICATIONS PERIOD [NOT TO MENTION ANYTHING LIKE CLIPBOARD ACCESS BETWEEN PROGRAMS. TO GET AN IDEA OF HOW INTEGRAL IT IS SEE: http://msdn.microsoft.com/en-us/library/windows/desktop/aa365574(v=vs.85).aspx YOU NEVER NEED TO CONNECT TO IPC$ SEE BELOW IN NET USE YOU SPECIFY A DRIVE LETTER AND IT AUTOMAGICALLY CHECKS WITH IPC$ TO ENSURE YOUR CREDENTIALS ARE VALID. I REPEAT I WARNED YOU ABOUT IPC$ DO NOT MUCK WITH IT UNLESS YOU KNOW WHAT YOU ARE DOING AND REALLY MUST TOUCH IT.

OK so after warning: First Run: NET USE X: [OR ANY DRIVE LETTER NOT USED] \\192.168.10.90\home\lgr /user:server[username] [password] [note we are using CIFS [SAMBA so directories are referenced as you would in Winblows]]

THEN

Robocopy X:\File.ext [or pattern like *.txt] C:\some\directory\to\save\to\file.ext

So shortened Net Use is Net use drive letter for network location in plain english really so don't forget to actually specify the drive letter [without drive letter it does kinda test the connection, but doesn't tell you you really are not using net use correctly].

Then we use robocopy to copy from the now in use drive letter which now points to a network location we told it to and copy from there to local [OR another net location should you use net use to map a second net location to a 2nd drive letter :-O ].

and when all done to disconnect net use x: /del /y [net use on x: delete yes delete without asking me] OR net use * /del /y would kill ALL connected net shares

and just net use in windows would list connections you have open and while it will connect to just a computer name that is just more of a direct confirmed peer-to-peer but still network based connection. The point behind net use is to take \\a really\long\network\share path and assign it to a drive letter so \my.server\net\share\somewhere becomes just X:\ [or whatever is free between A: and Z [I would not use A: B: C: D:] these are reserved A and B for floppies C: Main drive windows loads from and D: is normally CD/DVD drives [this is not hard and fast it can be different but generally this is how it goes] so I recommend lower in the alphabet letters like L - Z but totally up to you.

Pariah

Posted 2014-03-10T13:10:21.073

Reputation: 132

0

Sorry, could not reply directly so had to create a new answer, this is the short form my longer reply has more details if interested so I will leave both...

His question is for a windows host to a nix host [dunno if Linux or Unix prolly Linux] so /home/ is shared by default in most cases the share in Windows would be \\IP OR FQDN or WindBind address [usually FQDN or IP as Linux by default does not handle Windbind unless you manually enable it]

So in Windows to Linux using more defaults than not

net use X: \\192.168.10.90\home\lgr /user:IP [or FQDN if IP fails] of server\username

[Windows in my experience does not handle IPs well within the user statement for specifying host to auth against usually has to be FQDN [full DNS like server.local not just server almost all DNS clients set name.local by default if you only know Windows host name add .local it may work for you or winbind but IP can work some times]

Robocopy X:\*.* C:\LGR_Back_UP\LGR_A /s /e /z [copy all files including sub-directories even if directory is empty in restartable [if error in transfer re-copy file] mode if command fails delete /z and try again]

net use x: /del /y [disconnects net share on drive letter X without asking for interactive confirmation [since you use script you would want this]]

Sorry in reply to post above, but also includes robocopy command I would use in your case [if it fails with /z [restartable mode incase something happens during copy sometimes does not work in certain setups just leave it off] /s = copy all sub directories /e = including any empty sub-directories.

This should be easier to match up to your specific case and refer to my longer post above for more detail.

OH AND FOR YOU OTHER QUESTION TO GO "BACK" or UP A DIRECTORY LEVEL FROM WHERE YOU ARE CURRENTLY ISSUE

cd ..

and hit enter .. always refers to directory above in all OSes [you can use in scripts like so too if I have C:\some\directory and I run my script in directory if I do copy ..\file.ext C:\some\directory that would copy the file in the directory named some to the directory named directory when running the command when you are in directory at the command line :-)

OR

cd /

in Windows takes you to the root directory for the drive you are on so if I ran that from

c:\some\long\directory\that\takes\a\long\time\to\cd ..\from> cd /

I would get

c:\>

MUCH LOVE COMMAND LINE :-D

Pariah

Posted 2014-03-10T13:10:21.073

Reputation: 132