files

Can O.S tell me when a new file is created ?

Hello, I want to know when a new file is created on a specific directory, Instead of scanning the directory from time to time, I understand that there is a way to make the O.S tell my program that a new file was created. how does it work? Thanks Edit: as suggested below, this is similar to http://stackoverflow.com/questions/61253/how...

Reading a file from a hard drive in iPhone simulator

Is it possible to read a file (from my normal file system) into a iPhone App running on the iPhone Simulator? I understand that the iPhone itself has not got a (user accessible) file system but this is simply for testing and will only ever be run in the simulator. The file will be a text file that can be edited while the application is...

compare Filecontent Eclipse

Apache Commons IO FileUtils.contentEquals() compares 2 files. Is this also possible using code from eclipse.org ? ...

Best Practice for Web server file structure

Are there any best-practices for how to layout your webroot on a server? For instance, I currently have a site with this structure: /var/www/current/html (public dir for most recent revision) /var/www/dev/html (public dir for dev version) /home/user/www/html (for users public sandbox) How does everyone else layout their www file stru...

How to separate content from a file that is a container for binary and other forms of content

I am trying to parse some .txt files. These files serve as containers for a variable number of 'children' files that are set off or identified within the container with SGML tags. With python I can easily separate the children files. However I am having trouble writing the binary content back out as a binary file (say a gif or jpg). ...

Batch extract rars with spaces in names

I am trying to batch extract some rar's that are in some zip in some directories. Long story short this is my loop through the rar files: for %%r in (*.rar) do ( unrar x %%r ) Problem is that %%r gets the wrong value. If the files name is "file name.rar" then %%r gets the value "file" - it stops at the first space in the file name. ...

PHP Uploading Files

I'm having a problem uploading files in PHP. When I submit, $_FILES[] is empty. I feel like this is such a n00b question :/ My form: <form method="post" action="uploadfile.php"> <input type="hidden" name="MAX_FILE_SIZE" value="300000" /> Image: <input name="ImageFile" type="file" /><br /> <input type="submit" value="Add Image" /><b...

Determine if a path within an NSString is to a directory, or a file?

I have an NSString containing a path, but it could be either a file, or a directory. Is there an equivalent to the Python os.path.isdir() and os.path.isfile() methods in Cocoa? ...

Python: Mixing files and loops

I'm writing a script that logs errors from another program and restarts the program where it left off when it encounters an error. For whatever reasons, the developers of this program didn't feel it necessary to put this functionality into their program by default. Anyways, the program takes an input file, parses it, and creates an outp...

Renaming a series of files

Trying to rename a series of files on a linux server. Finding the files I want is easy: find . -type f -wholename \*.mbox Of course, being mbox files, some of them have spaces in the names, so it becomes: find . -type f -wholename \*.mbox -print0 I'm piping to xargs so that I can rename the files: find . -type f -wholename \*.mbo...

SharePoint - Posting and Retrieving files Automatically via VBScript

Hello All, I'm going to need to push and pull files from a SharePoint site that is not hosted by my company (it is external). I'm only going to get a few days (if that) to get this working so I don't have much time to experiment. To add to my requirements/headaches, I'm going to have to implement this with VBScript. .Net would be pref...

How do you reset a C# .NET TextReader cursor back to the start point?

I have a method that takes either a StringReader instance (reading from the clipboard) or a StreamReader instance (reading from a file) and, at present, casts either one as a TextReader instance. I need it to 'pre-read' some of the source input, then reset the cursor back to the start. I do not necessarily have the original filename. Ho...

read from binary file with variable length records

Hello, I have a binary file with variable length record that looks about like this: 12 economic10 13 science5 14 music1 15 physics9 16 chemistry9 17 history2 18 anatomy7 19 physiology7 20 literature3 21 fiction3 16 chemistry7 14 music10 20 literature1 The name of the course is the only variable length record in the f...

How can I implement a non-cached file copy using VB.NET 2005?

I have a program I wrote that copies select files from one remote computer to another. The set up I for testing is, one computer(a) at home running the program connected to my work's network via VPN and two computers(b,c) at work side by side on the same network. I am trying to copy the files on computer b to computer c, while the progra...

Inter process Reader Writer lock (or file handles and access denied)

Okay, some background first. We needed an inter-process reader/writer lock. We decided to use a file and lock the first byte using LockEx and UnlockEx. The class creates a file in the system temp folder when it is created. The file is created with readwrite access and share read|write|delete. We also specify DeleteOnClose so we don'...

Can you attach Amazon EBS to multiple instances?

We currently use multiple webservers accessing one mysql server and fileserver. Looking at moving to the cloud, can I use this same setup and attach the EBS to multiple machine instances or what's another solution? ...

File rewrite not working?

test.php <?php $filec = fopen('test.txt','w'); $arr = file('test.txt'); foreach ($arr as $key => $value) { fwrite($filec,$value); } fclose($filec); ?> test.txt asdjlaksjd asdhfwejkyhtjkre jfdhgdjkf'hgjldsff sfjnkbnm,cv sm,nxcm,b, sdjlhfskld jfsdfwerwlur slfdjsdkljfklsdjf When I run test.php, test.txt is emptied. Does anyone ...

find in files using ruby or python

A popular text editor has the following "find in files" feature that opens in a dialog box: Look For: __searchtext__ File Filter: *.txt; *.htm Start From: c:/docs/2009 Report: [ ] Filenames [ ]FileCount only Method: [ ] Regex [ ]Plain Text In fact, several popular text editors have this. I would...

OpenXml File Format Design and Best Practices

Folks, We have been using OpenXml APIs found in System.IO.Packaging for creating a package file that contains some Xml/Binary files, hence the package is some how structured as below: Package/ -/DataFolder1/an xml file.xml -/DataFolder2/another xml file.xml -/Bin/other binar files This has been used for version 1.0 of the applicat...

batch rename to change only single character

How to rename all the files in one directory to new name using the command mv. Directory have 1000s of files and requirement is to change the last character of each file name to some specific char. Example: files are abc.txt asdf.txt zxc.txt ... ab_.txt asd.txt it should change to ab_.txt asd_.txt zx_.txt ... ab_.txt as_.txt ...