';没有这样的文件或目录';如果进程以编程方式运行(从C#)

';没有这样的文件或目录';如果进程以编程方式运行(从C#),c#,linux,hadoop,process,mono,C#,Linux,Hadoop,Process,Mono,我有一个将大量文件转储到目录的应用程序。我想使用Hadoop命令将这些文件复制到Hadoop集群。我使用以下代码来运行该命令 System.Diagnostics.ProcessStartInfo export = new System.Diagnostics.ProcessStartInfo(); export.RedirectStandardOutput = false; export.RedirectStandardError = false; export.UseShellExecute

我有一个将大量文件转储到目录的应用程序。我想使用Hadoop命令将这些文件复制到Hadoop集群。我使用以下代码来运行该命令

System.Diagnostics.ProcessStartInfo export = new System.Diagnostics.ProcessStartInfo();
export.RedirectStandardOutput = false;
export.RedirectStandardError = false;
export.UseShellExecute = false;
export.WorkingDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
export.FileName = "hadoop";
export.Arguments = "fs -copyFromLocal " + Path.Combine(dumpDirectory, "*.txt") + " " + hadoopPath));
Console.WriteLine("Copying data: hadoop " + export.Arguments);

System.Diagnostics.Process proc = System.Diagnostics.Process.Start(export);

proc.WaitForExit();
if (proc.ExitCode == 0)
{
    IEnumerable<string> files = Directory.EnumerateFiles(dumpDirectory);
    foreach (string file in files)
        File.Delete(file);
}
else
    Console.WriteLine("Error copying to Hadoop: " + proc.ExitCode);
System.Diagnostics.ProcessStartInfo export=新系统.Diagnostics.ProcessStartInfo();
export.RedirectStandardOutput=false;
export.RedirectStandardError=false;
export.UseShellExecute=false;
export.WorkingDirectory=Path.GetDirectoryName(System.Reflection.Assembly.getExecutionGassembly().Location);
export.FileName=“hadoop”;
export.Arguments=“fs-copyFromLocal”+Path.Combine(dumpDirectory,*.txt”)+“”+hadoopPath));
WriteLine(“复制数据:hadoop”+export.Arguments);
System.Diagnostics.Process proc=系统.Diagnostics.Process.Start(导出);
进程WaitForExit();
if(proc.ExitCode==0)
{
IEnumerable files=Directory.EnumerateFiles(dumpDirectory);
foreach(文件中的字符串文件)
文件。删除(文件);
}
其他的
WriteLine(“复制到Hadoop时出错:+proc.ExitCode”);
程序写入以下消息:

复制数据:hadoop fs-copyFromLocal/local/directory/*.txt/user/remote/directory/

copyFromLocal:`local/directory/*.txt':没有这样的文件或目录

复制到Hadoop时出错:1

有趣的是,当我手动运行该命令时,文件复制没有错误

此外,如果程序在不使用
*.txt
的情况下运行该命令,而是分别为每个文件调用该命令,则该命令将成功


有人能解释一下吗?

我创建了一个包含给定命令的bash脚本,部分解决了这个问题。我以编程方式运行bash脚本,它运行正常


但是,我仍然不知道为什么原始版本不起作用。

尝试将DumpDirectory设置为./local/directory/*.txt