如何复制文件从windows到mac在单声道

本文关键字:mac 声道 单声道 何复制 复制 文件 windows | 更新日期: 2023-09-27 18:03:50

正如标题所说,我想用单声道从windows复制文件到mac。下面是我的c#代码:

using System;
using System.IO;
namespace CopyFiles
{
    public class EmptyClass
    {
        public static void Main()
        {
            string windowsPath = "''''another-machine-name''Share''Tem";
            string macPath = "..";
            CopyFiles (windowsPath, macPath);
        }
        public static bool CopyFiles(string oldPath, string newPath)
        {
            Directory.CreateDirectory (newPath); 
            if (!Directory.Exists (oldPath)) { 
                return false;
            }
            string[] directories = Directory.GetDirectories (oldPath);
            if (directories.Length > 0) { 
                foreach (string   d   in   directories) { 
                    CopyFiles (d, newPath + d.Substring (d.LastIndexOf ("''")));
                } 
            } 
            string[] files = Directory.GetFiles (oldPath);
            if (files.Length > 0) { 
                foreach (string   s   in   files) { 
                    File.Copy (s, newPath + s.Substring (s.LastIndexOf ("''"))); 
                } 
            } 
            return true;
        }
    }
}

winowsPath为共享路径。我不知道怎么写mac路径。有人能帮我吗?

如何复制文件从windows到mac在单声道

我假设代码将在OS X端运行。

OS X为文件系统/提供了一个根节点。其他的都在根节点下。例如,您的主文件夹中的document.doc将被引用为/Users/Long/document.doc

如果您不确定文件的位置,那么您可以按照以下步骤查找:

  • 在Finder
  • 中找到容器文件夹
  • 打开新的终端窗口
      <
    • 类型kbd> c d {空间}
  • 将文件夹从Finder拖到终端
  • {返回}
  • <
  • 类型kbd> p w d {返回}

这将把当前工作目录更改为您放入finder中的目录,然后pwd将打印出工作目录(在屏幕上),以便您可以看到路径应该是什么样子。