From c1c4c207dc98c8ff6b6c133d4e806546c1d327cd Mon Sep 17 00:00:00 2001 From: Michael Pozhidaev Date: Wed, 13 Feb 2019 10:15:55 +0700 Subject: [PATCH] Moving doc/ to etc/ --- {doc => etc}/CharacteristicsLink.txt | 0 etc/ex | 43 +++++++++++++++++++ .../java/org/luwrain/windows/Windows.java | 5 +++ 3 files changed, 48 insertions(+) rename {doc => etc}/CharacteristicsLink.txt (100%) create mode 100644 etc/ex diff --git a/doc/CharacteristicsLink.txt b/etc/CharacteristicsLink.txt similarity index 100% rename from doc/CharacteristicsLink.txt rename to etc/CharacteristicsLink.txt diff --git a/etc/ex b/etc/ex new file mode 100644 index 0000000..55a650a --- /dev/null +++ b/etc/ex @@ -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 + + diff --git a/src/main/java/org/luwrain/windows/Windows.java b/src/main/java/org/luwrain/windows/Windows.java index e48b4bd..c97d28d 100644 --- a/src/main/java/org/luwrain/windows/Windows.java +++ b/src/main/java/org/luwrain/windows/Windows.java @@ -89,4 +89,9 @@ interface ChannelBasicData { return filesOperations; } + + @Override public OsInterface getInterface() + { + return null; + } }