Note that there are some explanatory texts on larger screens.

plurals
  1. PORename files in a directory based on other directory
    primarykey
    data
    text
    <p>I'm having several outputs of a program that I need to compare with a "expected" ouput folder. But my problem is that the output files always have a different filename. </p> <p>How can I rename all files in a folder to the same filenames in another folder. Here the example - the expected file structure (can of course change):</p> <pre><code>expected/folder1/file1.txt expected/folder1/file2.txt expected/folder2/file1.txt expected/folder3/file1.txt </code></pre> <p>And my output looks like this (number of files and position is always equal):</p> <pre><code>result/folder1/fileOtherName1.txt result/folder1/fileOtherName2.txt result/folder2/fileOtherName1.txt result/folder3/fileOtherName1.txt </code></pre> <p>I tried using ANT (because I know that), but was stuck, because I cannot select a file by the index (sorted alphabetically).</p> <p>Here my pseudocode in ANT (but don't know how to continue):</p> <pre><code>&lt;target name="foo"&gt; &lt;foreach&gt; &lt;fileset dir="result" casesensitive="yes"&gt; &lt;include name="**/*.txt"/&gt; &lt;/fileset&gt; &lt;antcall target="rename"&gt; &lt;/antcall&gt; &lt;/foreach&gt; &lt;/target&gt; &lt;target name="rename"&gt; &lt;!-- how can I access another fileset and take the correct file? --&gt; &lt;!-- Here I got stuck --&gt; &lt;echo message="foreach.file is ${foreach.file}" /&gt; &lt;echo message="foreach.dir is ${foreach.dir}" /&gt; &lt;echo message="foreach.name.ext is ${foreach.name.ext}" /&gt; &lt;echo message="foreach.name is ${foreach.name}" /&gt; &lt;/target&gt; </code></pre> <p>Thanks for any help, it must not be in <strong>ANT</strong> only - a <strong>BASH</strong> script or similar could do the job too.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload