Ant task to run an Ant target only if a file exists?
Available and Condition <target name=”check-abc”> <available file=”abc.txt” property=”abc.present”/> </target> <target name=”do-if-abc” depends=”check-abc” if=”abc.present”> … </target>
Available and Condition <target name=”check-abc”> <available file=”abc.txt” property=”abc.present”/> </target> <target name=”do-if-abc” depends=”check-abc” if=”abc.present”> … </target>
// exists returns whether the given file or directory exists func exists(path string) (bool, error) { _, err := os.Stat(path) if err == nil { return true, nil } if os.IsNotExist(err) { return false, nil } return false, err } Edited to add error handling.
Assuming we’re only doing text files here and not some crazy binary stuff. Number 1: how to read an entire file into memory. (slurp “/tmp/test.txt”) Not recommended when it is a really big file. Number 2: how to read a file line by line. (use ‘clojure.java.io) (with-open [rdr (reader “/tmp/test.txt”)] (doseq [line (line-seq rdr)] (println … Read more
Since PowerShell 5 in Windows 10, you can look at FileVersionRaw (or ProductVersionRaw) on the output of Get-Item or Get-ChildItem, like this: (Get-Item C:\Windows\System32\Lsasrv.dll).VersionInfo.FileVersionRaw It’s actually the same ScriptProperty from my Update-TypeData in the original answer below, but built-in now. In PowerShell 4, you could get the FileVersionInfo from Get-Item or Get-ChildItem, but it would … Read more
You don’t see anything, because of buffering. The output is shown, when there are enough lines or end of file is reached. tail -f means wait for more input, but there are no more lines in file and so the pipe to grep is never closed. If you omit -f from tail the output is … Read more
You can use %%~nf to get the filename only as described in the reference for for: @echo off for /R “C:\Users\Admin\Ordner” %%f in (*.flv) do ( echo %%~nf ) pause The following options are available: Variable with modifier Description %~I Expands %I which removes any surrounding quotation marks (“”). %~fI Expands %I to a fully … Read more
I think the main difference I can describe relates to record oriented vs. column oriented formats. Record oriented formats are what we’re all used to — text files, delimited formats like CSV, TSV. AVRO is slightly cooler than those because it can change schema over time, e.g. adding or removing columns from a record. Other … Read more
Use basename(“C:/some_dir/a.ext”) # [1] “a.ext” dirname(“C:/some_dir/a.ext”) # [1] “C:/some_dir”
There is the “Compare” plugin. You can install it via Plugins > Plugin Manager. Alternatively you can install a specialized file compare software like WinMerge.
According to seppo0010 comment, I used the rename function to do that. http://nodejs.org/docs/latest/api/fs.html#fs_fs_rename_oldpath_newpath_callback fs.rename(oldPath, newPath, callback) Added in: v0.0.2 oldPath <String> | <Buffer> newPath <String> | <Buffer> callback <Function> Asynchronous rename(2). No arguments other than a possible exception are given to the completion callback.