Can we undo file.delete() function in java? [duplicate] - java

This question already has answers here:
Using Java's File.delete() method
(4 answers)
Closed 6 years ago.
I was trying to delete some duplicate files in my folder which is around 230GB. Therefore, I searched for files with the names _2 or _3 and use the
file.delete();
However, it deletes the files that I wasn't expecting it. Can I undo that process or are those files deleted permanantly?

The Files are gone. See this Question below
http://stackoverflow.com/questions/11106850/using-javas-file-delete-method
So, about the workaround, If this was on windows, using recovery tools like "File Scavenger" might help you out.

Related

How to have a program print it's location? [duplicate]

This question already has answers here:
How to get the current working directory in Java?
(26 answers)
Closed 2 years ago.
I have a java program and I want it to be able to print out its location on the computer. For example, if I were to place the program in the Downloads folder, and run it, it would print out the path to the file.
new File(MyClass.class.getProtectionDomain().getCodeSource().getLocation()
.toURI()).getPath();
make sure to change the Myclass.class stuff
then system.out.println(File)

How to get the plugin.yml in a plugin jar? [duplicate]

This question already has answers here:
Access file in jar file?
(5 answers)
Closed 5 years ago.
I am currently coding a server-panel which will be able to configure plugins and so on.
The only problem I currently have is, I want to get the plugin.yml from inside the jar file.
Is there an API or anything out there, which can get this file decompiled and then read the plugin.yml????
The plugin.yml gets put into the .jar. If you opened the .jar up with something like winrar you can access the file.

Restore source code of the app [duplicate]

This question already has answers here:
Is there a way to get the source code from an APK file?
(32 answers)
Closed 8 years ago.
I used revert local history and now there is no code at all. I have a working version of the app on my phone.
Is there any way I can get the source code back from my phone?
No. You can't get exact source code from .apk file.
You can try find your answer here.
Is there a way to get the source code from an APK file?
But this will not the exact copy of your project.

What would be the most diffident way of file copying using java? [duplicate]

This question already has answers here:
Standard concise way to copy a file in Java?
(16 answers)
Closed 10 years ago.
I need to write a application to copy files(.jar,.xml,.sql,.exe) from different location to some specific location What would be the most efficient way of file copy using java?
Use java.nio.file.Files.File#copy which intoduced in java 7. Example -
Files.copy(source, target, REPLACE_EXISTING);
This is covered, in some detail, in Basic I/O tutorial

How to test if a file is open in Java? [duplicate]

This question already has answers here:
Check if file is already open
(8 answers)
Closed 4 years ago.
Is it somehow possible to test if a java.io.File is currently open in another process by any process ? I am using Java 7 and target platforms are Linux/Windows/Mac.
There is no easy way in Java to go about this that will work reliably across different platforms. Depending on what you're trying to do, you might be able to patch together a series of try/catch statements which ostensibly work for most cases on most file systems, but you can never have full certainty that the next situation it encounters won't throw it off.
If you do end up going this route you want to ensure that when there is any doubt, it fails fast and doesn't get into a situation where it thinks a file is not open when it really is. My advice would be to see if there is any way you can possibly work around having to do this check.

Categories

Resources