Loop the folder and locate the specific file in R

I am trying to loop through many folders in a directory, looking for a particular xml file buried in one of the folders. I would then like to save the location of that file and then run my code against that file (I will not include that code in this)

How to handle Exception from Singleton java?

I have a singleton class public class SingletonText { private static final CompositeText text = new CompositeText(new TextReader("text/text.txt").readFile()); public SingletonText() {} public static CompositeText getInstance() { return text; }}

From a file, how can I read from a certain point in C ++

What I want to do: I need to create in void main() 3 auto objects. For each object I have the information in a txt file. How do I get the information (engine, max_speed... etc) for each object. How do I skip reading "engine" and how do I skip a

Check if the file was created and deleted?

I need to test a program that creates temporary file. When run finishes it deletes the file. How can I check it file has be created and deleted. I am thinking about sending some signals to process (like Ctrl-Z) to suspend it and check but should be s

Obtain a template parameter from the file

I have two classes: A non-type templated class Foo A non-templated class Bar which contains a member of Foo, where the template parameter should be read from a file. From what (I think) I know, this doesn't work because the template parameters of the

Deleting a text file in PHP

I have a text file that ends up with over 500 lines of text each day. I'm setting up a cron job to manually clear the file at the end of the day but I cannot get it to clear. I've looked online and tried the methods below, but nothing seems to clear

File management - Check an entire word

How to check for a string in a file as a whole word? For example, when I use strstr() and search for a word "google", it includes both google and agoogle. I want to read word by word from a text file in C. I use fgets, which reads a whole line f

Looping into files in the directory

I want to loop trough all files in given path to directory and echo the type of each file. So far I managed to do these: for file in `ls $path` do if [[ -f "$file" ]]; then echo "file" fi if [[ -d "$file" ]]; then echo "

List of files from the src folder

I want to list all files, that are located in a folder named icons. But the special feature is, that I want to start ot from the src folder in Eclipse. I want to use something like this: File f = new File("src/icons"); File[] fileArray = f.listF

How do I validate a file for my program? C ++

I have a program that reads a file and then do various things with the information that it reads. Now, I want to make a function that checks all the information that is inside the file before allocating the information into memory. I'm not sure if wh

how to create an empty sql file on the server

I want to check if a file exists, and if not, I would like to create it. The file is a SQL file. I've already got the code to check if it exists but I don't know how I can create it if it doesn't exist.Creating a SQL file is the same as creating any

Loop two Ruby files

What's the neatest way to iterate over two files simultaneously, so that if line 57 in file_1 == 'x' then treat line 57 in file_2 this way? My code below isn't working, but I know there is a simple solution out there... @blue = [] @red = [] file_1 =

C # My own file format

I'm looking to make my own file format . that format should contains pictures/pdf/and other files ... also need to know how I can packer-unpacker for this format to unpack files from it/pack in it & reading the pictures from my own format to picture

C ++ Playing a file with several types on the same line

I have a file that looks like this: Mike 1200 John 350 Jen 1500 Tara 700 Michelle 2000 Kevin 500 Matt 450 Kim 200 My code to store the contents: #include <iostream> #include <string> #include <fstream> #include <iomanip> using name

drop-down list only with a specific file with php

I'm currently making a droplist but in the droplist let's say I only want to include only .txt extension files so any other extensions like .php .jpg or any other extensions will not be in in the droplist. How can I do that as simple as possible? Ano

How to RSYNC a single file?

Currently i only RSync-ing the Directories as like: * * * * * rsync -avz /var/www/public_html/images [email protected]<remote-ip>:/var/www/public_html So how do i rsync one single file like, /var/www/public_html/.htaccess ?You do it the same way as you would a

Save the file under a different name

I have a Java form in which you can select a file to open. I have that file: File my_file = ... I want to be able to save my file as a different name. how can I do it using "File my_file"? I tried: File current_file = JPanel_VisualizationLogTab.

Where to deposit a text file

I'm working on an App, and in the main folder of the app, I have a text file with a list of sites. I'm having some trouble manipulated the file. I want to ship the text file with info inside of him with the App, and in the App give the user a place w

Inserting text into a text file

Alright, this maybe the simplest (or the stupidest) question, but I just got to know... Suppose I have a text file containing account no. and balance. I am writing a program to search the file using entered account no. and update the balance field in

Java createNewFile () - will it create directories?

I've got a conditional to check if a certain file exists before proceeding (./logs/error.log). If it isn't found I want to create it. However, will File tmp = new File("logs/error.log"); tmp.createNewFile(); also create logs/ if it doesn't exist

Writing files with std on iOS

i added a save.txt to my iPhone resource in xCode, with a same text "..." i write some strings to the file, and than read it, but when i read it, i only get the old content.. so there is nothing new written into it NSString* resources = [ [ NSBu

Fast Copy of Progressive Files

I'm writing an SDL application for Linux, that works from the console (no X server). One function I have is a file copy mechanism, that copies specific files from HDD to USB Flash device, and showing progress of this copy in the UI. To do this, I'm u

How do I determine the file format? DOS / Unix / MAC

I have written the following method to detemine whether file in question is formatted with DOS/ MAC, or UNIX line endings. I see at least 1 obvious issue: 1. i am hoping that i will get the EOL on the first run, say within first 1000 bytes. This may

Read a text file and upload the content to the mysql database

I need a php script to read a .txt file. The content of the text file are like this: data.txt 145|Joe Blogs|17/03/1954 986|Jim Smith|12/01/1976 234|Paul Jones|19/07/1923 098|James Smith|12/09/1998 234|Carl Jones|01/01/1925 These would then get stored

How do I save an image to a file?

I'm trying to use a standard Intent that will take a picture, then allow approval or retake. Then I want to save the picture into a file. Here's the Intent I am using: Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE ); sta

Wait for the file to be unlocked in .NET

What's the simplest way of blocking a thread until a file has been unlocked and is accessible for reading and renaming? For example, is there a WaitOnFile() somewhere in the .NET Framework? I have a service that uses a FileSystemWatcher to look for f