FileAlreadyExistsException When Using Files.copy

I am trying to copy a file from an InputStream into a local directory. I created a local directory called test, and it is located in my package root. public void copyFileFromInputStream(InputStream is) { Path to = Paths.get("test"); Files.copy(i

How to get all the files in a folder?

In my program I have a treeview and a folderbrowser and a datagridview. The user uses the folder browser to choose a folder which contains bunch of shows which all have different seasons. My program displays the folders for the shows and the season f

How to call a google apps script from a page of squares?

I am playing with readymade code in my squarespace website. I found a way to upload files to my google drive by setting up a readymade google apps script. It works fine on the url given by publishing the app. However i implemented the html code from

Java read the contents of a text file

import; import java.util.Scanner; import java.lang.*; public class ReadFile { public static void main(String[] args) { int i=0; String[] myStringArray = new String[]{ }; try { Scanner input = new Scanner(; File file = new File(

Large number at the beginning of the data read from a C file

I have a code snippet, where I want to read columnar data from a txt file. However, whenever I do so, a large number - namely - -1.073742e+008 gets appended to the beginning of the file. I do not know where it is coming from or how to get rid of it.

The file is corrupted during the download

I have got this code from one of the site for file downloads. Did implemented this code but it only gets download but when I tried to view the file it shows me error in the file. I did downloaded various file formats like pdf, docx ,doc but it always

Python open file - do not you need a full path to the file?

Every example I see about opening a file in Python has something like this: myFile = open('somefilenamehere', 'r') It never works for me when I just type the file should always put full directory path where that file is myFile = open('C:\\

Date of printing and scanning

I want to read a date from a text file in a single variable/array in this format : Thu Feb 05 16:48:30 2015 to print i used : fprintf (savegame,"Played Date : %s ",ctime(&time1)); but what to do scan ? Edit : Ok . so i probably said somethin

I want to write to a new file not add for each iteration

I want to create a new file for each iteration, but I'm not able to do so. I'm only able to update the same old file, how could I solve this? The other more basic question what is "" function in file.write("".)? I have tried with "

Test if the user entered a word equal to a word in a text file

Let's say that I have a file with this in it: passcode Now, what I want to do is have some code with user input that should test if what the user entered what is equal to what is in the file. Is there a any way I can do this? Here is the code that I

PHP GET variable test

Trying to do something that should be very easy but not for me. I am trying to pass a variable thru a $_GET to php and store it in a text file. The variable ip is posted from an external source. I have the following: The xxx represent the ip address

Counting words in a file

I am trying to write a function which will count the numbers of words in a file. But for some reason when I run it an error occurs: def wc(filename): """returns the number of words in file filename.""" f = open(filename, 'r')

Number of open files in a C ++ program

Is there a simple way to get the number of files opened by a c++ program. I would like to do it from my code, ideally in C++. I found this blog article which is using a loop through all the available file descriptor and testing the result of fstat bu

Android: write text on txt

With the following code, I try to write to my sdcard: public void writedata(String data) { //BufferedWriter out = null; System.out.println(data); try{ FileOutputStream out = new FileOutputStream(new File("/sdcard/tsxt.txt")); out.write(data.getB

Long string used in Java

Let say I have to used a two paragraph string in my java program. What would be the best approach on this? Should the paragraph saved in a file and retrieved when used? Or there are better approach?It depends. If the paragraphs will never change, the

Comparison of existing files not as expected

I am trying to compare the contents of a file with a String object. But even though the contents are same, it is telling that the contents are different and adding the same contents again and again. For every run of this code, same content is rewritt

Do & hellip; While () loop does not work well

I am prompting the user to enter data regarding cars. The Do...while() loop I am using works fine the first time, then does not work properly after the first time. The code is bellow, and I am using Dev-C++. Thank you for your help and time. #include

MIME type PHP $ _FILES returning null

Right now I'm trying to write a script that will only accept certain audio files for upload to a server. However, some MIME types are being returned as null. Here is some code fragments: PHP: $allowedExt=array('audio/mp4a-latm'); if(isset($_POST)) {

Reduce the exe file

Using Delphi (or in general any tools, if exist of course), is it possible to reduce size of an exe file, removing all code that not is used but that is present there? (for example, a function or procedure that is present but is never called). I reme

Age of the file in Java

I need to find the age of a file based on its name. Alle the files keep to a naming convention like this: DD-MM-YYYY. I can make a program to come up with the filenames based on how many days/months has passed etc, using the modulus operator, but i c

Downloading files to the Linux server from Windows C #

I have to write a C# program that only needs to work on Windows. It needs to allow the user to select a file to upload. That file will be uploaded to a folder on a remote Linux server. I know the username, password, and url for this Linux machine. Do

Native JDK code for copying files

Is there a native JDK code to copy files(buffers, streams, or whatever)?If by "native" you mean "part of the Java standard API" (rather than platform-dependant code, which is usually called "native" in the Java world) and by

How to run a file using VisualBasicScript (.vbs)

How can I run a file with VisualBasicScript (.vbs)? The file is 'file.bat' and it's located in the same dir as the .vbs.yes i want to run it. Then try this: CreateObject("WScript.Shell").Run "file.bat"

Importing CSV files into .Net

I realize this is a newbie question, but I'm looking for a simple solution - it seems like there should be one. What's the best way to import a CSV file into a strongly-typed data structure? Again simple = better.Check out FileHelpers Open Source Lib