Skip to content

Commit

Permalink
Moving doc/ to etc/
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Pozhidaev committed Feb 13, 2019
1 parent 3910277 commit c1c4c20
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
File renamed without changes.
43 changes: 43 additions & 0 deletions etc/ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Path file = ...;
try {
DosFileAttributes attr = Attributes.readDosFileAttributes(file);
System.out.println("isReadOnly is " + attr.isReadOnly());
System.out.println("isHidden is " + attr.isHidden());
System.out.println("isArchive is " + attr.isArchive());
up vote 20 down System.out.println("isSystem is " + attr.isSystem());
vote } catch (IOException x) {
System.err.println("DOS file attributes not supported:" + x);
}


http://openjdk.java.net/projects/nio/javadoc/java/nio/file/attribute/DosFileAttributeView.html



Path path = ...;
Boolean hidden = path.getAttribute("dos:hidden", LinkOption.NOFOLLOW_LINKS);
if (hidden != null && !hidden) {
path.setAttribute("dos:hidden", Boolean.TRUE, LinkOption.NOFOLLOW_LINKS);
}


//locate the full path to the file e.g. c:\a\b\Log.txt
Path p = Paths.get("c:\\a\\b\\Log.txt");

//link file to DosFileAttributes
DosFileAttributes dos = Files.readAttributes(p, DosFileAttributes.class);
up vote 1 down
vote //hide the Log file
Files.setAttribute(p, "dos:hidden", true);

System.out.println(dos.isHidden());

}
}

To check the file is hidden. Right-click on the file in question and you will see after the execution of the court that
the file in question is truly hidden.

enter im


5 changes: 5 additions & 0 deletions src/main/java/org/luwrain/windows/Windows.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,9 @@ interface ChannelBasicData
{
return filesOperations;
}

@Override public OsInterface getInterface()
{
return null;
}
}

0 comments on commit c1c4c20

Please sign in to comment.