EzDevInfo.com

file interview questions

Top file frequently asked interview questions

Create a temporary directory in Java

Is there a standard and reliable way of creating a temporary directory inside a Java application? There's an entry in Sun's issue database, which has a bit of code in the comments, but I wonder if there is a standard solution to be found in one of the usual libraries (Apache Commons etc.)


Source: (StackOverflow)

How to checkout only one file from git repository?

How do I checkout just one file from a git repo?


Source: (StackOverflow)

Advertisements

Writing files in Node.js

I've been trying to find a way to write to a file when using Node.js, but with no success. How can I do that?


Source: (StackOverflow)

Standard concise way to copy a file in Java?

It has always bothered me that the only way to copy a file in Java involves opening streams, declaring a buffer, reading in one file, looping through it, and writing it out to the other steam. The web is littered with similar, yet still slightly different implementations of this type of solution.

Is there a better way that stays within the bounds of the Java language (meaning does not involve exec-ing OS specific commands)? Perhaps in some reliable open source utility package, that would at least obscure this underlying implementation and provide a one line solution?


Source: (StackOverflow)

How do I get the directory from a file's full path?

What is the simplest way to get the directory that a file is in? I'm using this to set a working directory.

string filename = @"C:\MyDirectory\MyFile.bat";

In this example, I should get "C:\MyDirectory".


Source: (StackOverflow)

Remove a symlink to a directory

I have a symlink to an important directory. I want to get rid of that symlink, while keeping the directory behind it.

I tried rm and get back rm: cannot remove 'foo'.
I tried rmdir and got back rmdir: failed to remove 'foo': Directory not empty
I then progressed through rm -f, rm -rf and sudo rm -rf

Then I went to find my back-ups.

Is there a way to get rid of the symlink with out throwing away the baby with the bathwater?


Source: (StackOverflow)

How do I save a String to a text file using Java?

In Java, I have text from a text field in a String variable called "text".

How can I save the contents of the "text" variable to a file?


Source: (StackOverflow)

Rename a file in C#

How do I rename a file using C#?


Source: (StackOverflow)

Read all files in a folder

I want to read all the files in a folder through Java. Can anyone help me?


Source: (StackOverflow)

Convert DOS line endings to Linux line endings in vim

If I open files I created in Windows, the lines all end with ^M.
How do I delete them all in once?


Source: (StackOverflow)

How can I get a file's size in C? [duplicate]

Possible Duplicate:
How do you determine the size of a file in C?

How can I find out the size of a file? I opened with an application written in C. I would like to know the size, because I want to put the content of the loaded file into a string, which I alloc using malloc(). Just writing malloc(10000*sizeof(char)); is IMHO a bad idea.


Source: (StackOverflow)

How to get file creation & modification date/times in Python?

I have a script that needs to do some stuff based on file creation & modification dates but has to run on Linux & Windows.

What's the best cross-platform way to get file creation & modification date/times in Python?


Source: (StackOverflow)

How can I get the list of files in a directory using C or C++?

How can I determine the list of files in a directory from inside my C or C++ code?

I'm not allowed to execute the 'ls' command and parse the results from within my program.


Source: (StackOverflow)

Need a minimal Django file upload example [closed]

As a newbie to Django, I am having difficulty making an upload app in Django 1.3. I could not find any up-to-date example/snippets. May someone post a minimal but complete (Model, View, Template) example code to do so?


Source: (StackOverflow)

How can I get Eclipse to show .* files?

By default, Eclipse won't show my .htaccess file that I maintain in my project. It just shows an empty folder in the Package Viewer tree. How can I get it to show up? No obvious preferences.


Source: (StackOverflow)