I want to create a file in Drive which is shared over the network.If I give normal path for file creation like :-
D:\\Folder\FileName.txt
this works but If I give
hostname\\Folder\Filename.txt
This gives me Access Denied Error.
Folder is shared to ALL/Everyone
I am using windows 7.
Related
I want to get all files from WhatsApp's .Statuses folder. Until Android 10 im perfectly getting all statuses files. But on Android 11 due to new restrictions, when I code like below:
File(Environment.getExternalStorageDirectory().absolutePath + File.separator + "Android/media/com.whatsapp/WhatsApp/Media/.Statuses").listFiles()
I always get 0 files. Whereas, Im successfully getting other folder files "Android/media/com.whatsapp/WhatsApp/Media/" on this path.
Two problems I'm facing now:
If a folder is hidden then in Android 11, listFiles() returns 0 on that folder.
If a folder not hidden but contains one file as ".nomedia" , listFiles() returns 0 on that folder as well in Android 11.
What should I do to get all whatsapp statuses files in Android 11?
I dont want to use MANAGE_EXTERNAL_STORAGE permission for it due to google policies. Thank you
There are ways to access Hidden Directory in Android 11, two of them are:
Storage access framework (SAF) in which you take user to that specific directory and ask for permission from user to access directory files and that way you get access to files in it (Study SAF).
You can use File Observer on that hidden folder and whenever any file created or modified or deleted from that hidden directory you will get full path in that case for that specific file in hidden folder & once you have full path you can have access to that file.
I am getting a file permmission error when I use my Java applet on my website.
The error is:
access denied ("java.io.FilePermision""image.png""read")
An applet operates in a restricted environment (known as a security sandbox) and,unless it is signed, can only load resources from the same location from where it was loaded. The images can be included in the applet jar file. To access these, you could use
Image image = ImageIO.read(MyApplet.class.getResourceAsStream("/images/image.png"));
Applets are by default denied from accessing the client's file I/O. You need to sign your applet or edit the policy files.
You can check How Can An Applet Read Files On The Local File System
I am creating an application for Android which enables users to create encrypted LUKS partitions and then mount them to given directories on external memory.
For the partition to be usable I create an ext2 file system using the Busybox mkfs.ext2 command. The problem occurs once a user tries to create a file/directory at the root of the partition. For some reason it is impossible to create a file through Java as the "File.mkdirs()" method fails. However, it is possible to create this file through the command-line. And this error occurs only when at the root of the partition (i.e if I create a folder through the command line I am then able to create files within that folder through Java). Also, I am able to create a file if I create a vfat file system instead of ext2.
Any help would be greatly appreciated.
Harry
EDIT
Fixed. I was mounting the file system as root
My final solution to this problem was to create a vfat file system rather than ext2 as vfat doesn't have permissions etc... This worked for me as I did not need the extra security of permissions. However, if you need an ext2 file system which you need to mount as root but want it to be useable by other users I recomment looking into the mount ownmask option (man mount).
I am looking for an appropriate way to store and access pdf files in my Android app.
The problem is: I have 5 pdf-files which I would like to store in the project resources and load in the app.
I have tried to make a new directory in the project root /myApp/pdfs, and accessing it by:
File myFile = new File("/myApp/pdfs/,fileName);
I have tried some different variants of the path name: ./myApp/pdfs, myApp/pdfs, /pdfs, ./pdfs. However I get the same message stating that the file can't be found.
How do I get the path to my apps directory? And is this the most appropriate approach for saving a small number of pdf-files?
If you are wanting to load the pdfs from the app (while the app is running), you probably want to store them in the res/raw folder.
I have a piece of Java that create folder(s) on a network mapped drive (Z:)
Script executes on server A (Windows 2008 R2, running as user account "serviceUser") and creates folder(s) on server B (Windows 2003)
The root folder on server B (which is mapped as Z:) has special permission and allows "serviceUser" to create, modify, delete, write, etc. Permissions are set to inherit to child object, so folder created in Z: should get the same permissions as Z: itself.
My code creates 2 folders inside Z: like:
File destination = new File("z:\\folder_1\\");
File destination = new File("z:\\folder_1\\subfolder_1\\");
Folder "folder_1" gets the correct permissions but "subfolder_1" does not.
After creating those folders, I need to create a file, but as the "subfolder_1" doesn't get permissions, console reports "Access is denied" when doing File fileName = new File("z:\\folder_1\\subfolder_1\\filename.png");
How can I fix this problem?
Have you tried the mkdirs command? It will delegate to the OS to create all needed directories in your overall path.
File destination = new File("z:\\folder_1\\subfolder_1");
destination.mkdirs();
Try to use: setReadable() and/or setWritable() on your folder2. This is the only portable pure java way to control file permissions.
The only successfull way I found to make this work was to set the user account as an administrator of Server B with full control.