1

I currently have this command:

copy /b *.txt newfile.txt

But I want to include all files with folders as well.

  • How can I do this? Is it possible to add this to Apache Ant as well?

I also consider doing this to minify JS files.

  • Is there anyway to remove lines as well?
  • Is there a better command to use than the one I am currently using?

CURRENT CODE

<target name="concatenate" description="Concatenate all js files">
    <concat destfile="build/application.js">
        <fileset dir="js" includes="**/*.js" />
    </concat>
</target>
<target name="compress" depends="concatenate" description="Compress application.js to application-min.js">
    <apply executable="java" parallel="false">
        <filelist dir="build" files="application.js" />
        <arg line="-jar" />
        <arg path="C:\yuicompressor-2.4.7\build\yuicompressor-2.4.7.jar" />
        <srcfile />
        <arg line="-o" />
        <mapper type="glob" from="*.js" to="build/*-min.js" />
        <targetfile />
    </apply>
</target>
Kenster
  • 8,620

1 Answers1

0

On a nix OS you can use:

 find | xargs cat | sed ':a;N;$!ba;s/\n/ /g'

This will first find all files under the current folder, than concatenate them and than remove new line characters with sed script that adds lines to a register without the new line.

I suspect from the use of copy command that you are using Windows, you will have to find the windows equivalents to the nix commands.
find for example can be replaced with dir /s /b. type might be a fine replacment for cat. etc.

Or you can have a look in this answer https://stackoverflow.com/questions/127318/is-there-any-sed-like-utility-for-cmd-exe that explain how to use nix command tools on windows.

amotzg
  • 979