How to detect new or modified files
I found there are two ways to approach it, ReadDirectoryChangesW and FindFirstChangeNotification, I want to know what’s difference between them, performance or other??? ...
I found there are two ways to approach it, ReadDirectoryChangesW and FindFirstChangeNotification, I want to know what’s difference between them, performance or other??? ...
Hello all, I have this command that I run everyday via cron: find /home/get/public_html/videos -daystart -maxdepth 0 -mtime +1 -type f -name "*.flv" |xargs rm -f The problem is that it doesn't delete the .flv files in a directory that are 1 or more days old. How can I correct the above command? EDIT: Paul - the command "ls -l /ho...
I am using a FileSystemWatcher in VS2005 to monitor directories and thought to change the application to a service. Eveverything woks fine until the service tries to delete a file. Sending the exception to the eventviewer, I get a System.UnauthorizedAccessException. The file in question (testing) can be deleted by the same FileSystemWatc...
I can quite easily dump data into a text file such as: sqlcmd -S myServer -d myDB -E -Q "select col1, col2, col3 from SomeTable" -o "MyData.txt" However, I have looked at the help files for sqlcmd but have not seen an option specifically for CSV. Is there a way to dump data from a table into a CSV text file using sqlcmd? ...
Is there a way to tell when a file was moved to a certain directory? I'm being asked why a script of mine did not find a file in a certain directory. The file was created last January but I suspect it was placed in the directory after the script was run. Is there a way for me to confirm my suspicion? Viewing the file properties gives...
Currently our Java application uses the values held within a tab delimited *.cfg file. We need to change this application so that it now uses an XML file. What is the best/simplest library to use in order to read in values from this file? ...
Studying C#, my books are showing me classes for readin files. I've found 2 that are very similar and the Visual Studio debugger doesn't show an obvious difference between the two. code: FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read); FileStream fs = File.Open(path, FileMode.Open, FileAccess.Read); Now I wond...
Recently there have been a few attackers trying malicious things on my server so I've decided to somewhat "track" them even though I know they won't get very far. Now, I have an entire directory containing the server logs and I need a way to search through every file in the directory, and return a filename if a string is found. So I tho...
I'm working with a legacy php script. There is a file upload form in it already, but I've added another one for a different section in the same script. The $_file['file'] is there. But I keep getting a open_basedir restriction error, and if not that, I get a permission error. I wouldn't mind working around these problems, but the thing...
Hey, I'm writing an app that supposed to copy a bunch of files from one place to another. When I'm using TFileStream for the copy it is 3-4 times slower than copying the files with the OS. I also tried to copy with a buffer, but that was too slow aswell. I'm working under Win32, anyone got some insights on this matter? ...
Today I had the problem that I couldn't delete a folder because "it was busy". How can I find out which application to blame for that or can I just delete it with brute force? ...
I have a path and I need to determine if it is a directory or file. Is this the best way to determine if the path is a file? string file = @"C:\Test\foo.txt"; bool isFile = !System.IO.Directory.Exists(file) && System.IO.File.Exists(file); For a directory I would reverse the logic. string directory = @"C:...
In Windows Mobile I am using FindFirstFile/FindNextFile to search for some files. As part of the results I am getting a WIN32_FIND_DATA structure which contains one search result. This structure contains 3 FILETIME structures for file creation, last write and last access times. Then I am converting these structures to SYSTEMTIME using ...
I'm looking to take the results of a report run (a PDF file from Crystal Reports), serialize it, stick it into a varbinary field, and then later be able to deserialize it and present it back to the user. For now I have to just plain old ADO .NET (SqlClient, SqlCommand, etc.) Are there any pitfalls to this? What is the basic syntax to a...
Hello everyone! I need to concatenate 3 files using C#. A header file, content, and a footer file, but I want to do this as cool as it can be done. cool = really small code or really fast (non-assembly code). ...
Hello all, I have the following command which deletes files that are one day old and that are of mp3 file type. find /home/get/public_html/audio -daystart -maxdepth 1 -mtime +1 -type f -name "*.mp3" |xargs rm -f The problem with this is when i run it, it sometimes says "fork": resource xargs not available. Does this mean, t...
Hi, I need to create big relatively big (1-8 GB) files. What is the fastest way to do so on Windows using C or C++ ? I need to create them on the fly and the speed is really an issue. File will be used for storage emulation i.e will be access randomly in different offsets and i need that all storage will be preallocate but not initia...
Hi, Following my question about creating files. After fast creation of large file, now i need to create a file system on this file. How can i create something like Loop device on Linux. After this i guess formatting will be really easy. Any alternative method (instead mounting) for formatting file to different FAT (12/32) and ext3 are ...
Hello all, There is a data file and some image files that I have to download to our local servers every night using asp.net. What is the best way to do this? UPDATE Ok, after viewing the responses I see my initial post of using asp.net is a poor choice. How would you write it for a console app in C#. I am not sure what classes I am us...
Consider a Save As dialog with a free text entry where the user enters a file name as free text, then clicks a Save button. The software then validates the file name, and saves the file if the name is valid. On a Unix file system, what rules should be applied in the validation such that: The name will not be difficult to manipulate l...