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

No space left on device?

According to df there is plenty (about 50G) space left on the device. / # df db Filesystem 1K-blocks Used Available Use% Mounted on /dev/mmcblk0p3 61812032 11308736 50503296 18% /db Why might this vala code indicate…
jacknad
  • 13,483
  • 40
  • 124
  • 194
5
votes
2 answers

Progress bar with Apache FileUtils.copyDirectory(...)

Does anyone know any way of implementing progress bar for Apache's FileUtils.copyDirectory(File src, File dst)? I don't see anything helpful in JavaDocs and API. Seems like a common use case in dealing with batch disk operations, so I'm not sure if…
ŁukaszBachman
  • 33,595
  • 11
  • 64
  • 74
4
votes
2 answers

Check Duplicate File content using Java

We have a 150 Gb data folder. Within that, file content is any format (doc, jpg, png, txt, etc). We need to check all file content against each other to check if there are is duplicate file content. If so, then print the file path name list. For…
Mostafizur
  • 69
  • 2
  • 9
4
votes
1 answer

Apache Commons IO FileUtils listFiles: how to get list of files with no extension?

I am trying to get a list of files with no extension using org.apache.commons.io.FileUtils.listFiles() like…
Alexander
  • 71
  • 1
  • 1
  • 4
4
votes
0 answers

Moving/Copying a file to another directory creates empty file and empties source

My goal is to move a file from one directory to another. The source is on a local drive and the destination is on a network drive. It doesn't matter whether I move or I copy then delete source. The file is approx 6GB. What I've tried: //…
Gander7
  • 569
  • 1
  • 6
  • 24
4
votes
2 answers

Ruby FileUtils.mkdir_p is only creating parent directories

I have a controller in Rails, with an action that is meant to create a new directory. This action should create the directory "/public/graph_templates/aaa/test". However, it leaves off the final directory "test". Why is this only creating parent…
Don P
  • 60,113
  • 114
  • 300
  • 432
4
votes
1 answer

How to continue copying on error with copyDirectory from FileUtils (Apache Commons IO 2.4)

I am trying to copy files from one folder to another using the FileUtils method "static void copyDirectory(File srcDir, File destDir)" from apache commons io (2.4) with the following code: String srcDir = "/sourceDirectory/examples/"; String…
Exocom
  • 791
  • 2
  • 8
  • 24
3
votes
1 answer

How to catch errors when copying files in Ruby?

I copy a file like this: require 'fileutils' FileUtils.copy(source_file, dest_file) I would like to know if this operation succeeded, and if not, what was the error. Where could I find the exceptions that can be thrown?
Misha Moroshko
  • 166,356
  • 226
  • 505
  • 746
3
votes
1 answer

Apache Common FileUtils readLines method ambiguous call

I stumbled upon this problem when trying to play around with Apache commons IO third party API with Android Studio. Basically when I try to call the FileUtils.readLines() method, there are 3 options: readLines(File file) >>>> DEPRECATED…
blue2609
  • 841
  • 2
  • 10
  • 25
3
votes
1 answer

Can't read js file from url in correct encoding

I want to read js file as string from url https://d3c3cq33003psk.cloudfront.net/opentag-67008-473432.js I tried several ways (to read from url or to download and then read), but all the time I received unreadable characters, like…
Marina Rappoport
  • 109
  • 1
  • 10
3
votes
1 answer

Java FileNotFoundException with Absolute path - Cant Read or Execute, but file exists

I'm sure this has been answered, but ten different strategies hasn't worked on this issue. If I use C:\Users\Anny\Dropbox\SocialMediaOcto\instructions\Trees\instructions.txt as my absolute path for the file, IDEA cannot read or execute from…
Jayizzle
  • 532
  • 1
  • 6
  • 24
3
votes
1 answer

Exception on Mac only: Unexpected end of file from server

I am downloading mp3 and image files using "org.apache.commons.io.FileUtils" in the following code successfully on windows 7: FileUtils.copyURLToFile(new URL(urlString),myFile); but on mac os x Yosemite version 10.10.2 (14C1514) I get this…
Amr Lotfy
  • 2,937
  • 5
  • 36
  • 56
3
votes
0 answers

FileUtils.moveFileToDirectory with special characters in file name

I'm using FileUtils.moveFileToDirectory on a file with special characters in its name, for exemple : ╩╦╠═╬╧╨╤... and other kind of alt code characters. I can see these characters on the file name on the server before moving the file, but once the…
NeS
  • 147
  • 1
  • 2
  • 10
3
votes
1 answer

OutOfMemory error when using Apache Commons lineIterator

I'm trying to iterate line-by-line a 1.2GB file using Apache Commons FileUtils.lineIterator. However, as soon as a LineIterator calls hasNext() I get a java.lang.OutOfMemoryError: Java heap space. I've already allocated 1G to the java heap. What am…
crockpotveggies
  • 12,682
  • 12
  • 70
  • 140
3
votes
2 answers

Apache Common IO FileUtils Issue

I am trying to use the FileUtils.writeStringToFile() method of the Apache Commons IO. Every bit of documentation says that I can do this: FileUtils.writeStringToFile(File, String with data, boolean append); I want this method, because I want the…
snowfi6916
  • 697
  • 4
  • 9
  • 21
1
2
3
15 16