Questions tagged [fileutils]

FileUtils is a File manipulation utility from Apache Commons

FileUtils or org.apache.commons.io.FileUtils is File manipulation utility from Apache Commons

234 questions
0
votes
1 answer

Replacing entire directory ignoring duplicate files

I'm trying to transfer over files from one directory to another. I am currently using this method to accomplish this task: File srcDir = new File("path\to\file"); File destDIr = new File("path\to\file"); File.Utils.copyDirectory(srcDir,…
user4332327
0
votes
2 answers

Error while using FileUtils

I am using FileUtils from apache commons.io to search text between two strings in a file with the following code: Pattern p = Pattern.compile(Pattern.quote(fromDate) + "(.*?)" + Pattern.quote(toDate)); try { Matcher m = p.matcher(fileContent); …
iymrahul
  • 94
  • 1
  • 1
  • 11
0
votes
1 answer

Requiring ruby gems giving mixed results

Noticed today that running require fileutils in pry always returns false. But, if I do the same thing in irb, it returns true. Furthermore, when fileutils is set to false, it still works! First I thought that fileutils is a dependency of pry, and…
binarymason
  • 1,351
  • 1
  • 14
  • 31
0
votes
1 answer

Copying files from one directory to another is not working in Ruby

I am using fastlane and snapshot to create screenshots automatically. To facilitate this I need to copy data into the app. In this case a series of folders and documents from one folder into another within a .app container. So far the Documents…
Mark Reid
  • 2,611
  • 3
  • 23
  • 45
0
votes
0 answers

Write a file in resources in a java maven project

I have to implement a temporary "persistence" solution for retrieving some definitions ( simple json strings). I have a rest endpoint which creates an instance of my object and then I want to write the json definition inside a file. I currently…
D.Razvan
  • 325
  • 1
  • 5
  • 18
0
votes
0 answers

Java - Saving file from JAR to disk

I'm trying to save a YAML formatted file packaged in the JAR to the user's disk. The file is named config.yml and sits directly under one of the project's source folders. I can confirm that the file is packaged in the JAR with WinRAR. I am using…
Evan McCoy
  • 11
  • 3
0
votes
2 answers

Getting HTTP 302 when downloading file in Java using Apache Commons

I am using the following method to download a file off the internet: try { URL url = new URL("http://search.maven.org/remotecontent?filepath=com/cedarsoftware/json-io/4.0.0/json-io-4.0.0.jar"); FileUtils.copyURLToFile(url, new…
Anon10W1z
  • 167
  • 10
0
votes
0 answers

File download from URL with FileUtils

I'm using the below to let the user download to the latest version of my program. FileUtils.copyURLToFile(URL, new File(directory)); This works fine, however I can't figure out how best to let the user know that the file download is complete. The…
0
votes
1 answer

Javafx exception when trying to copy fire

I've got a javafx application, what I'm trying to do is to copy one folder with a different name in the same folder if that makes sense. My application starts normally and I've got a set of buttons on my first stage/scene. I'm trying to get this to…
Kylar Stern
  • 77
  • 1
  • 2
  • 8
0
votes
2 answers

How do I escape a String for XML?

How do I escape a String for XML? package test; import java.io.File; import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringEscapeUtils; public class XmlEscapeTest { public static void main(String[] args) throws…
Duckkiee
  • 3
  • 1
  • 7
0
votes
1 answer

File copy from shared source folder to local destination folder using Apache FileUtils failed

I am trying to copy a file which is at remote machine shared folder using following code. myMethod (String paramUrl) { //URL of the folder shared on Remote machine logger.info("paramUrl="+paramUrl); URL url = new URL(paramUrl); …
0
votes
3 answers

FileUtils.readFileToString() from Apache Commons IO works incorrectly with Cyrillic

I am using FileUtils.readFileToString to read contents of a text file with JSON at once. The file is UTF-8 encoded (w/o BOM). Yet, instead of cyrillic letters I get ?????? signs. Why? public String getJSON() throws IOException { File…
Mikhail Batcer
  • 1,938
  • 7
  • 37
  • 57
0
votes
0 answers

Ruby check for a list of directories

I am trying to come up with a mechanism that will check whether a list of known directories exist before creating them on the system. To do so, I wrote the following; but it does not really work. I believe there must be an issue with the each loop…
makabde
  • 85
  • 11
0
votes
2 answers

deleting temp files onexit java vm

A Web application runs on tomcat server, creates a temp files and deletes it once its usage over, but some error scenarios temp files are not being deleted. which are stacked up and never deleted. Used deleteOnExit() seems not working, after tomcat…
JAVAC
  • 1,230
  • 3
  • 17
  • 38
0
votes
1 answer

Create new directory in parent directory of current directory -- ROR FileUtils.mkdir

This is my basic hierarchy ... MYPROJECTS/MYRAILSAPP/source_code_folders I have a folder MYPROJECTS that holds my ror applications My application source code is held in a folder called MYRAILSAPP which is within MYPROJECTS Source code is in…
ma77c
  • 1,052
  • 14
  • 31