file

Ruby: How can I edit the contents of a CSV file?

As a follow up to this question, how can I edit the contents of a CSV file? I ultimately need to replace all instances of something and I need to do that before I open the file for parsing (with FasterCSV). So, using Ruby I need to open, edit, and save the CSV file. ...

Moving a file containing a space in ruby using FileUtils

Hi everyone, I'm using Mac OS X and I'm trying to write a little script that moves a file to a specific folder. I'm using the FileUtils API since I don't want to run system specific commands (system("mv a b"). The script looks something like this: #!/usr/bin/env ruby require 'rubygems' require 'escape' require 'fileutils' absolut_inp...

How can I test if a filename matching a pattern exists in Perl?

Can I do something like this in Perl? Meaning pattern match on a file name and check whether it exists. if(-e "*.file") { <Do something> } I know the longer solution of asking system to list the files present; read it as a file and then infer whether file exists or not. ...

Convert File to HEX String Python

How would I convert a file to a HEX string using Python? I have searched all over Google for this, but can't seem to find anything useful. ...

Mark File For Removal from Python?

In one of my scripts, I need to delete a file that could be in use at the time. I know that I can't remove the file that is in use until it isn't anymore, but I also know that I can mark the file for removal by the Operating System (Windows XP). How would I do this in Python? ...

PHP Case Insensitive Version of file_exists()

I'm trying to think of the fastest way to implement a case insensitive file_exists function in PHP. Is my best bet to enumerate the file in the directory and do a strtolower() to strtolower() comparison until a match is found? ...

Creating a custom file like object python suggestions?

Hi i am looking to implement my own custom file like object for an internal binary format we use at work(i don't really want to go into too much detail because i don't know if i can). I am trying to go for a more pythonic way of doing things since currently we have two functions read/write(each ~4k lines of code) which do everything. How...

Parallel Processes Results Written To Single File

I am new to Linux and was introduced to the "&" recently. I have to run several traceroutes and store them in a single file, and I am curious if I am able to kick off these traceroutes in parallel? I tried the following but the results in the generated file, are not kept apart? Well, that is what it seems to me. traceroute -n -z 10...

change file extention?

What the best way is change file extention of Java? ...

CKEditor Default File Path

Using CKEditor (combined with KCFinder for file upload), when I use the browse button and retrieve my file I get the path: "/demo/cms/uploads/images/image.jpg" Which is the path to the image, however if I then move the file around within the editor, the automatically path changes to: "uploads/images/image.jpg" Which won't work from...

Where to put a file when reading from SD Card (Android Development)

If I am going to be reading files from the SD Card, where do I put them during development? Also, when I install the app, will it include these files and put them to the SD Card? ...

Java: File type of `url.openStream()`

I wrote this this method to download a webpage given a URL. It is designed to download HTML only. If I want to do error checking and allow HTML only how should I do this? public static String download(URL url) throws IOException { InputStream is = url.openStream(); BufferedReader reader = new BufferedReader(new InputStreamRe...

Determine file type from data?

I've got some data that is coming in through a byte stream. I want to determine its file type so I know how to parse it. At present, I'm only concerned about HTML or Images, everything else can be discarded. What's an efficient method of differentiating between the two? And what if I want to expand this to include other file types? ...

convert array into .txt file

Possible Duplicate: Convert array into csv Hi, How to convert array into .txt file? This is my array: Array ( [OrderList_RetrieveByContactResult] => Array ( [OrderDetails] => Array ( [0] => Array ( [entityId] => 1...

Write a file temporarily on disk in C#

I have the following problem: I have some (binary) files, which are embedded in a resource. For some reasons I must write these files temporarily on disk. How should I proceeded ? Maybe this can be done with GetRandomFilename() or GetTempFileName() ? ...

windows batch file with goto command not working

Hello all, I have a problem with GOTO command and affiliated labels. Facts: Given a bunch of files from a folder (they are log errors) I need to open them and check if they contain a specific string. If yes then eliminate some characters (all the chars after the last appearance of "_", including itself) from the file names and do othe...

restoring the state of application

Actually, I am creating a new application through java. I want that if a user opens a previously created file in my application then the condition of my application should be restored to where he left while saving that file. --Thanks in advance ...

Submit form using jquery

I'm trying to submit a form using JQuery. My problem comes from the fact that the front end (html+js/jquery) and the back-end is not on the same site, but it does support JSONP. The form contains a file input field, so I would be submitting Multi-part form data. How would you resolve this? ...

How to change file extensions using FTP remote?

Hello, how can I change several .xsd extensions to .xml using FTP remote? Thanks in advance ...

Load multiple files using HTML5 and PHP

I am trying to load multiple files using HTML5. This is my code I found on some site. In the PHP code it doesn't recognize it as an array. Am I doing something wrong? Can someone show me a working solution? Thanks. index.html <form action='save.php' method='post' enctype='multipart/form-data'> <input name="uploads" type="file" multip...