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
2
votes
1 answer

FileUtils: Skips files that are already in destination and copy rest of the files

I am using the following method to transfer files between two directories using java. FileUtils.copyDirectory(sourceDir, destinationDir,fileFilter,false); But if a file with the same name is also found in the destination directory, the file from…
2
votes
1 answer

Why does Pathname.rmtree fail on Signal.trap('EXIT')

I’m trying to make a temporary directory that is removed when the script exits. #!/usr/bin/env ruby require 'pathname' require 'tmpdir' Tmp_dir = Pathname.new(Dir.mktmpdir) Signal.trap('EXIT') { Tmp_dir.rmtree puts 'Doing cleanup' } puts…
user137369
  • 5,219
  • 5
  • 31
  • 54
2
votes
2 answers

Replacing deprecated Java method

I have multiple calls that use deprecated methods, such as org.apache.commons.io.FileUtils.readFileToString(File file) org.apache.commons.io.IOUtils.toString(InputStream input) org.apache.commons.io.IOUtils.toInputStream(String input) Now, I do…
knallfrosch
  • 387
  • 6
  • 16
2
votes
0 answers

How to delete a folder after calling FileUtils.saveAndUnzipToTempDir

I am using FileUtils.saveAndUnzipToTempDir for unzipping folder/files to a temp directory, and I want to delete that folder once I'm finished going through the folder. I don't have a great java experience, but I think that the saveAndUnzipToTempDir…
display_name
  • 91
  • 1
  • 1
  • 7
2
votes
5 answers

FileUtils not showing suggestion to import predefined class for Screenshot functionality in selenium WebDriver

I am not allowed to use FileUtils in the program and error is shown when doing so. Even no suggestion is showing to import this pre-defined Class. I tried to search the solution but what I found was to import the class. But in my case even…
Anil Kumar
  • 23
  • 1
  • 1
  • 4
2
votes
1 answer

Get filtered file list from apache FileUtils

I'm tring to get file list with specific name. But it is not easy to use FileterUtils from apache commons. My goal is getting all files with pattern *_fact_.*. I tried to as below. Iterator picFiles = FileUtils .iterateFiles( …
sungyong
  • 2,267
  • 8
  • 38
  • 66
2
votes
1 answer

file.delete() returning false even file is writable

I'am trying to copy a file to a directory and then deleting it, but file.delete() keeps returning false Here is my code: for (File file : list) { if (!file.isDirectory()) { try { …
Vithor Escames
  • 116
  • 1
  • 3
  • 17
2
votes
1 answer

How to get the specific files in pattern-matching directory Ruby

I would like to write a Ruby script that would find if the directory from the same pattern then copy the folders and files inside to another directory. For example, if I want to find a pattern of directory that is:…
kerrysugu
  • 123
  • 1
  • 1
  • 9
2
votes
2 answers

Java - How to move files using FileUtils?

Everyone keeps saying how simple it is to move a file from point a to point b using fileutils, but I'm having lots of trouble moving a file :( I have a /temp/ folder in the directory wherever the .jar is located, in this temp folder I have a .txt…
peterxz
  • 864
  • 1
  • 6
  • 23
2
votes
1 answer

java - Progress Bar while download with FileUtils

I'm trying to download a large file from URL with commons.io Apache library. This is my code: InputStream stream = new URL(CLIENT_URL).openStream(); ProgressMonitorInputStream pmis = new ProgressMonitorInputStream(null, "Downloading...",…
luca89pe
  • 97
  • 1
  • 14
2
votes
1 answer

Waiting for File Lock to Be Released

There are some Java questions similar to this one but none of them had accepted answers that I could find and my situation is a little more specific. I have a program that processes files one at a time as they are fed into a directory. At times,…
Pablo Vadear
  • 95
  • 1
  • 10
2
votes
1 answer

ruby - Permission denied after File.open and rename

I modify a file and then try to rename it and rename his directory. But I get a permission denied error. Here is my code : # 1) Modify the xml file Xml_file = "Directory/foo.xml" begin contents = File.new(Xml_file).read $document =…
2
votes
1 answer

create temp file using utils in java not using : java.io.File.createTempFile()

Currently I am using java.io.File.createTempFile() to create a temp file. But it has a validation to filter out those file names which is less than 3 words. Like this if (prefix.length() < 3) throw new IllegalArgumentException("Prefix string too…
user5070277
2
votes
3 answers

How to replace a string in an xml file without loading file contents into memory in java?

My application creates a very big xml file (of about 300K transactions). Each of the transaction will have about 20 xml elements. So it creates a huge xml file. We did not use JAXB or SAX or DOM for creation of xml file as memory is the constraint.…
2
votes
0 answers

getWritablePath() in cocos2d-x on Windows Phone gives weird results

I'm trying to get the writable path on Windows Phone in my game but CCFileUtils::sharedFileUtils()->getWritablePath() always returns me results like "H??", "???", "??y". I've already tried using this on cocos2d-x v2 and v3 with no luck. Also I have…
maksg
  • 21
  • 2
1 2
3
15 16