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

How can I read Arabic characters in a filename with FileUtils.listFiles in Java?

This is a method that returns a String array with all my files name in a specific folder. It works perfectly but doesn't work when reading a file with Arabic characters in it's filename. Any help is appreciated. String[] name = new String[10]; …
C-flow
  • 19
  • 1
  • 3
0
votes
1 answer

Read and Write file in java whilst keeping the special characters

After reading and writing the file, the bullet points get replaced with symbolic unreadable text "�". Here is the code: String str = FileUtils.readFileToString(new File(sourcePath), "UTF-8"); nextTextFile.append(redactStrings(str,…
Lez
  • 161
  • 1
  • 1
  • 13
0
votes
3 answers

Saving RDD as textfile gives FileAlreadyExists Exception. How to create new file every time program loads and delete old one using FileUtils

Code: val badData:RDD[ListBuffer[String]] = rdd.filter(line => line(1).equals("XX") || line(5).equals("XX")) badData.coalesce(1).saveAsTextFile(propForFile.getString("badDataFilePath")) First time program runs fine. On running again it throws…
0
votes
0 answers

Download large files with java from authenticated server

I need to implement the functionality to download multiple files from an authenticated server. But I'm receiving the following result, even though accessing via browser makes the download starts normally (if authenticated). 'Server returned HTTP…
Gabriel Brito
  • 1,003
  • 2
  • 16
  • 26
0
votes
1 answer

Take a screen shot and copy through FileUtils in Selenium WebDriver and java

When I try to get screen shots with following code it is showing error. FileUtils.copyFile(source, new File("*./Screenshots/facebook.png")); error message but when i try the following code it is okay. FileHandler.copy(source,new…
Rush910
  • 43
  • 1
  • 8
0
votes
3 answers

how to list all the files(with extension and without extension) under a specific directory

I am currently able to get all the files with specific file extension private List getListFiles(File parentDir) { ArrayList inFiles = new ArrayList(); File[] files = parentDir.listFiles(); for (File file :…
krishnamurthy
  • 1,574
  • 14
  • 14
0
votes
1 answer

Merge multiple files recursively using Java

I would like to merge the following .properties files into one. So for example I have structure: IAS ├── default │   ├── gateway.properties │   └── pennytunnelservice.properties └── FAT ├── gateway.properties ├── IAS-jer-1 │   └──…
Michal Sipek
  • 536
  • 1
  • 6
  • 23
0
votes
2 answers

Ruby send_file and store it directly to local folder using FileUtils

I am currently able to send a docx file for the user to download, question is how do I save the file created for download from the send_file method to store into a local directory in a ruby app? Below is the code that uses send_file: send_file…
Gooner
  • 369
  • 5
  • 16
0
votes
2 answers

How to preserve line break in String readAllBytes

Folks I am using a template file which will be fed into a String variable, however when i write the contents of the string it ignores the linebreaks in the file. How do i preserve the line breaks from original file so the output file also contains…
Sudheej
  • 1,873
  • 6
  • 30
  • 57
0
votes
0 answers

stopped copying large number of files using FileUtils

i am using library apache common io to copy file in my java program. when i tried to copy a lot of files (about 250.000) it just copied 4.454 and then stopped copying. i saw in the task manager it's still running. public void copyFiles(File source,…
Johan
  • 207
  • 4
  • 14
0
votes
0 answers

Java: Moving large files from one folder to another using FileUtils

I have a Java web application running on a Tomcat application server on a Windows machine that downloads files from a sFTP server in zip format. Next it unzips the files to an unzipped folder and finally it copies the files to an incoming folder…
Mathias G.
  • 4,875
  • 3
  • 39
  • 60
0
votes
1 answer

Getting "Unknown file type" in ruby

here's my code: > !#usr/bin/ruby require 'fileutils' Dir.chdir "/home/john/Documents" if (Dir.exist?("Photoshoot") === false) then Dir.mkdir "Photoshoot" puts "Directory: 'Photoshoot' created" end Dir.chdir "/run/user/1000/gvfs" camdirs…
0
votes
0 answers

Using java Fileutils.listfiles on large directories UNIX

I have a working tree which is the following: Root ├─Site1 | ├─file.def | ├─subfolder1 | └─subfolder2 ├─Site2 | ├─file.def | ├─subfolder1 | └─subfolder2 └─Site3 └... there are thousands of files contained in the subfolders. Now, I want to read…
0
votes
0 answers

How to copy files and sub-folders

I'm trying to copy files including sub-folders, but I'm getting a RunTimeError copy: unknown file type. I also created folders and files to test myself. Folders and files for test: - D: - backup_target - target1 - file1.txt…
Chris
  • 392
  • 4
  • 16
0
votes
0 answers

Java FileUtils - Avoid download of HTML

So I have an issue with the Apache Commons IO library, with FileUtils. My code : URL songUrl = new URL(urlToDl); newSon = new File("test.mp3"); FileUtils.copyURLToFile(songUrl, newSon); The problem is that sometimes (it's really random) the mp3…
Khrys aka Louis
  • 68
  • 2
  • 10