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

221 questions
57
votes
2 answers

Rails 5.2.0 with Ruby 2.5.1 console - `warning:` `already` initialized constant FileUtils::VERSION

I'm currently experiencing an issue with my new rails application, more specifically: Rails 5.2.0 Ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17] rvm 1.29.4 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin…
vchar
  • 846
  • 1
  • 9
  • 12
26
votes
1 answer

ruby copy folder with subfolders to a target location

I'm trying to copy a folder with all its subfolders from source to a destination folder. The below code doesn't seem to do it. I'm able to copy just the files instead of subfolders by using …
sasi
  • 259
  • 1
  • 3
  • 3
25
votes
6 answers

Using FileUtils in eclipse

When trying to use FileUtils I get "cannot be resolved" error. Then, how do I install FileUtils library to be able to use it in Eclipse? I see it is an Ant utility, but I am not sure how many jars I need to install.
prosseek
  • 155,475
  • 189
  • 518
  • 818
11
votes
3 answers

Java - Copy file to another directory using FileUtils and copyFileToDirectory - doesn't work -?

I would like to copy a file from one directory to another using Java and the FileUtils classes of apache org commons. I wrote up a quick java program to test on my local system. Here is the code. The file exists, but the copying of the file to…
katura
  • 2,147
  • 13
  • 38
  • 48
10
votes
2 answers

How can I recursively copy the directory contents and exclude the source directory itself?

Using FileUtils cp_r is usually how I copy directories, but I can't seem to exclude the base directory. This is what I wanted to work, but it doesn't: FileUtils.cp_r "#{source_path}\\**", target_path, :verbose => true source_path has…
George Horlacher
  • 171
  • 1
  • 3
  • 10
8
votes
2 answers

spring expression read file content

How to use spring expression to read file content and put it into a string? I would like to do the following. For example, @Value("classpath:myquery.sql") File f; @Value("#{org.apache.commons.io.FileUtils.readFileToString(f)}") String sql; Or even…
Timmy Chiu
  • 519
  • 4
  • 12
7
votes
1 answer

Ruby - FileUtils - dereference_root option

Can someone explain me exactly (better if with examples) the meaning of the dereference_root option in FileUtils.cp_r and in other class method of the same class? Thank you in advance.
Astorre
  • 75
  • 4
6
votes
1 answer

FileUtils.copyFile fails for large files

I have a simple Java app that is trying to copy a file across the WAN (from Ireland to NY). I recently modified it to use FileUtils because the native Java file copy was too slow. I researched and found that because Fileutils uses NIO it is better.…
Tony
  • 101
  • 1
  • 6
5
votes
1 answer

FileUtils copyURLToFile BasicAuthenication

How do I pass in user credentials for downloading files using apache commons FileUtils? I'm using an authenticator as below but doesn't seem to be working. It does not even complain about bad credentials so it looks like my authenicator is being…
Micho Rizo
  • 908
  • 1
  • 11
  • 24
5
votes
1 answer

Creating directory over SFTP on Ruby fails if directory exists already

How can I create a directory on Ruby via SFTP only when the directory doesn't exist? I have the following code right now: Net::SFTP.start( ip, id, :password => pass, :port=> port ) do |sftp| sftp.mkdir! remotePath sftp.upload!(localPath +…
Laurice Llona
  • 87
  • 1
  • 8
5
votes
2 answers

Cannot delete zip file after unzipping?

I am facing an unusal issue.I am building a tool which is scheduled to run every 5 mins. It will pick up the zip files from a particular directory and extract files (depending on the file name) to a destination. I am using zipentry to get each…
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
  • 12,453
  • 38
  • 115
  • 190
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
  • 32,989
  • 10
  • 61
  • 69
4
votes
0 answers

Error : javax.net.ssl.SSLException: Connection reset (Specific Website only)

Kind Attn Moderators: Before marking this query as duplicate, please note I have checked - Link1, Link2, Link3 & was unable to fix the issue. Also I believe the context & error is different from those, thus seeking help here. Context: Download a csv…
iCoder
  • 1,135
  • 3
  • 14
  • 27
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
1
2 3
14 15