Questions tagged [filevisitor]
20 questions
6
votes
3 answers
The correct way to use FileVisitor in java
I am trying to step through an entire path and its single layer of sub directories. For each file, I need to read five data fields and output them to a delimited text file. I'm able to read from a single text file and validate my output on screen;…

dwwilson66
- 6,806
- 27
- 72
- 117
2
votes
2 answers
SwingWorker with FileVisitor not publishing processed info quickly; GUI hangs
Using SwingWorker with FileVisitor not publishing processed info quickly; GUI hangs. I'd prefer it didn't and would like help with that problem.
Here's a brief outline of how I use SwingWorker with FileVisitor interface to search a Windows directory…

DSlomer64
- 4,234
- 4
- 53
- 88
1
vote
0 answers
Why is Files.walkFileTree not reporting unable to access mounted drive
My Java code traverses the root directories of computer in order to create a folder tree (for serving as json for web application)
for (Path path : FileSystems.getDefault().getRootDirectories())
{
…

Paul Taylor
- 13,411
- 42
- 184
- 351
1
vote
0 answers
In Java how do I create a structured tree using FileVisitor
Given a starting path I want to create a tree like object representing the filesystem using Java, showing all the folders down to level x but not ordinary files. . So using FileVisitor I know that every time just before Im going to browse a new…

Paul Taylor
- 13,411
- 42
- 184
- 351
1
vote
1 answer
FileVisitor to replace existing files
I need to replace file from one directory to another directory. I have searched in net and i found efficient solution to replace files . I am using Files.walkFileTree to traverse the directory and replacing file. Before replacing file i am checking…

Roshan
- 79
- 2
- 11
1
vote
0 answers
Java PathMatcher and SimpleFileVisitor without startingDir
In this example http://docs.oracle.com/javase/tutorial/essential/io/find.html
We have a SimpleFileVisitor implementation that uses PathMatcher to accept (or not) a visited file.
Path startingDir = Paths.get(args[0]);
String pattern =…

benji
- 2,331
- 6
- 33
- 62
1
vote
0 answers
Searching thousands of files via a thread and "tree walker", writing matches to JTable results in unresponsiveness
I have revised my Windows 7 search program to write matched files to a JTable. Prior to this I was writing to a JTextArea. The output was ugly; hence JTable output. But with JTable, the program becomes unresponsive from time to time if searching…

DSlomer64
- 4,234
- 4
- 53
- 88
1
vote
0 answers
Unable to compile walkFileTree method in Java
This is my Java Class:
public class PrintFiles extends java.nio.file.SimpleFileVisitor {
@Override
public FileVisitResult visitFile(Path file,
BasicFileAttributes attr) {
if (attr.isSymbolicLink()) {
…

Fresher
- 894
- 1
- 7
- 27
1
vote
0 answers
Exception when moving files
I'm assuming that this has to do with my limited knowledge of how the FileVisitor works and parses the directories. What I'm trying to do is to move the contents of a directory into another directory. I'm doing this by implementing FileVisitor…

Daniel Figueroa
- 10,348
- 5
- 44
- 66
0
votes
1 answer
Printing directories tree to a .txt file using FileVisitor
I'm trying to print the whole directories tree to .txt file and I'm having some issues since my program is just printing the first file line only.
The code is:
package n1exercici3;
import java.io.*;
import java.nio.file.FileVisitResult;
import…

Ketterle
- 11
- 2
0
votes
0 answers
using FileVisitor, how do I return the found file's path?
I need to find a file in a directory tree and return it's location to the calling function. I have FileVisitor implemented and it finds the file. How do I get it's location to return to the calling function? I've implemented Baeldung's Example in…

Phil18013
- 41
- 2
0
votes
1 answer
Java FileVisitor visit ordered in a directory
I am trying to use the Java's FileVisitor interface to walk through a list of files and import the contents onto a database. The scenario is to import the csv contents in order. There may be a file with name Object.csv, Object_updated.csv,…

dmachop
- 824
- 1
- 21
- 39
0
votes
1 answer
Moving not empty directory recursively using Java NIO.2 FileVisitor and Files.walkFileTree(...)
I saw a lot of examples of how to copy or delete files recursively by using Java NIO.2. For example, this is how to copy a folder with all its contents:
/**
* Copies a folder with all contents recursively. Class implements
* {@code FileVisitor}…

Ernestas Gruodis
- 8,567
- 14
- 55
- 117
0
votes
0 answers
javafx Update message from walkfiletree method of Filevisitor
I am using java 7 Files.walkFileTree method to traverse through whole disk. I am trying to update the javafx label and progress bar in the UI class I have created, from the visitFile() method of my custom FileVisitor.
In the javafx UI class I…
0
votes
2 answers
Using Java's file tree system to get only files and folders not subdirectories
So I have to use the Java file tree system because .listfiles files is for some reason incredibly slow going through a remote network. However all the Java file tree system examples list all the files in the subdirectories, severely slowing down the…

Brandan B
- 464
- 2
- 6
- 21