首页 \ 问答 \ 如何使用camel-exec在Linux中移动文件?(How do you move a file in Linux using camel-exec?)

如何使用camel-exec在Linux中移动文件?(How do you move a file in Linux using camel-exec?)

我是骆驼的新手。 我试图用它在Linux中将文件从一个位置移动到另一个位置。 为了实现这一点,我试图使用camel-exec

这是我尝试过的:

from("direct:exec")
.to("exec:mv test/directorySource test/directoryDestination")

当我运行我的代码时,我收到以下错误:

Unable to execute command [args=[], executable = mv null null timeout=..., outFile=null. workingDir=null, useStdeirOnEmptyStdout=false] 

注意:我使用的是Java DSL,而不是骆驼的XML版本。

我有一种感觉,我从命令中遗漏了一些东西,告诉它输入应该是什么,但我不确定。 我试图按照上面链接中的“执行Java”中的示例,但我无法让它工作。

有谁知道如何完成这个或我可能做错了什么?


I am new to camel. I am trying to use it to move a file from one location to another in Linux. To accomplish this, I am trying to use camel-exec:

Here is what I tried:

from("direct:exec")
.to("exec:mv test/directorySource test/directoryDestination")

When I run my code, I get the following error:

Unable to execute command [args=[], executable = mv null null timeout=..., outFile=null. workingDir=null, useStdeirOnEmptyStdout=false] 

Note: I am using the Java DSL, not the XML version of camel.

I have a feeling I am missing something from the command that tells it what the input should be, but I'm not sure. I tried to follow the examples in the link above for "Executing Java," but I haven't been able to get it to work.

Does anyone know how to accomplish this or what I might be doing wrong?


原文:https://stackoverflow.com/questions/36332413
更新时间:2022-03-25 09:03

最满意答案

你的对角线检查都是相同的方向。 grid[x+1, y+1]grid[x-1,y-1]都是从左上到右下的相同对角线。 对于另一个对角线,您需要添加到一个索引并从另一个索引中减去。

如果i是偏移量,0-3,那么一个对角线是:

grid[x+i, y+i]

另一个对角线是:

grid[x+i, y-i]

您必须将最终的for循环调整for正确的索引。


Your diagonal checks both are the same direction. grid[x+1, y+1] and grid[x-1,y-1] are both in the same diagonal, from top left to bottom right. For the other diagonal you need to add to one index and subtract from the other.

if i is the offset, 0-3, then one diagonal is:

grid[x+i, y+i]

and the other diagonal is:

grid[x+i, y-i]

You'll have to adjust your final for loops to the correct indices.

相关问答

更多
  • 我会创建一个获取元素的方法,如果坐标无效,则返回一个默认值。 只需使用默认值即可查找所需内容。 public char getWithDefault(int row, int col, char default ) { if ((0 <= row) && ( row < board.length) && (0<=col) && (col < board[row].length)) { return board[row][col]; } return default; } p ...
  • 最简单的算法可能是: for every direction for every coordinate check whether the next 3 elements in this direction exist and are the same 在代码中: final int maxx = 7; final int maxy = 6; char winner(char[][] board) { int[][] directions = {{1,0}, {1,-1} ...
  • 你的对角线检查都是相同的方向。 grid[x+1, y+1]和grid[x-1,y-1]都是从左上到右下的相同对角线。 对于另一个对角线,您需要添加到一个索引并从另一个索引中减去。 如果i是偏移量,0-3,那么一个对角线是: grid[x+i, y+i] 另一个对角线是: grid[x+i, y-i] 您必须将最终的for循环调整for正确的索引。 Your diagonal checks both are the same direction. grid[x+1, y+1] and grid[x-1, ...
  • 有两点需要指出。 首先,在您的情况下,您正在检查gameBoard[x-2][y-2] ,这应该是gameBoard[x-2][y+2] 其次,您应该在函数末尾添加一个return false ,以便在检查失败时返回false。 如果不添加return语句,它将不返回任何内容,因此undefined 。 There are two things to be pointed out. Firstly, in your condition you're checking for gameBoard[x-2][y ...
  • 解决这个问题的小窍门。 很明显,您在矩阵row和column索引计算中遇到了错误,并且您的循环不覆盖其中的所有单元格。 最简单的方法来检查它,只是打印出来控制台。 我可以看到,你有问题for (int row = 0; row < numSpots - 1; row++) 。 第一次迭代,当numSpots=1它跳过这个循环。 正确的是for (int row = 0; row <= numSpots - 1; row++) 。 让我给你一些关于你的例子的笔记。 我可以看到矩阵的上下两部分用相反的方向检查, ...
  • 我假设问题是如何让代码只显示警报一次 - 你应该设置一个标志,用户有一个标志,当游戏结束时,最后使用警报。 现在警报在循环中,因此每次循环都会触发警报。 I assume the question is how to make the code to show the alert only once - you should set a flag for which user has one and when the game has ended, then use the alert in the end ...
  • 你知道网格是20x20,所以只需将它粘贴到一个文本文件中并像阅读矩阵一样阅读它: for (int i = 0; i < 20; ++i) for (int j = 0; j < 20; ++j) inFile >> mat[i][j]; 然后做明显的事情:对于每个元素[i][j] ,向下4个元素,向右4个,向右4个,向左4个,找到产品。 如果因为边界而无法获得4个元素,请忽略可以获得的元素。 没有必要像你似乎在做的那样使这个复杂化。 保持简单,因为这是一个简单的问题,如果你过时了 ...
  • 尝试这个, /* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ class Ideone { public static void main (String[] args){ ...
  • 这是正确的代码。 我建议任何尝试这个问题的人都会花一些时间用铅笔和纸来实际看到这个模式。 这个问题本身很容易。 #include using namespace std; int input [20][20] ={{8,2,22,97,38,15,0,40,0,75,4,5,7,78,52,12,50,77,91,8}, {49,49,99,40,17,81,18,57,60,87,17,40,98,43,69,48,4,56,62,0}, {81,49,31,73,55,79, ...
  • 您正在检查相同的对角线。 在网格中绘制您正在检查的线条(在纸上),以便轻松查看。 改变其中一个从X中加入并从Y中减去(或者反过来)。 You are checking the same diagonal lines both times. Draw the lines you are checking in the grid (on paper), to see this easily. Change one of them to add from X and subtract from Y (or the ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。