windowsoracle-databasecygwinkshunc

cygwin - file copy to UNC share


First, I know absolutely nothing about CYGWIN so bear with me...

Our developers need to procure some text dumps from our DBAs. They work with Oracle on Windows via a CYGWIN environment, and kornshell.

Question: How can we use kornshell/cygwin to copy an old fashioned text file to a standard Windows network share (UNC address)?


Note: There is a workaround we have discussed, where the DBAs can drop the text files in a local temp folder, and then setup a Windows Task to copy/move the text file to a UNC address. We would like to avoid this kluge.


Solution

  • UNC paths are mapped to Cygwin paths by replacing \ characters with / characters.

    For example, a file that appears in Windows as

    \\server\dir1\dir2\foo.txt
    

    should appear in Cygwin as:

    //server/dir1/dir2/foo.txt
    

    If that doesn't work (it should), you can also map a drive letter to a UNC path. For example, if you map \\server\dir1 to S:\, then the same file (S:\dir2\foo.txt) should appear in Cygwin as /cygdrive/s/dir2/foo.txt.

    In short, a Cygwin command can treat a directory with a UNC path as an ordinary directory.

    See https://cygwin.com/cygwin-ug-net/using.html#unc-paths