65
votes
19answers
47k views
How check if given string is legal (allowed) file name under Windows?
I want to include batch file rename functionality in my application. User can type destination filename pattern and (after replacing some wildcards in pattern) I need to check if it's going to be ...
27
votes
13answers
31k views
Reliable File.renameTo() alternative on Windows?
Java's File.renameTo() is problematic, especially on Windows, it seems.
As the API documentation says,
Many aspects of the behavior of this
method are inherently
platform-dependent: The rename
...
10
votes
7answers
2k views
How to safely write to a file?
Imagine you have a library for working with some sort of XML file or configuration file. The library reads the whole file into memory and provides methods for editing the content. When you are done ...
5
votes
7answers
2k views
Can a program delete its own executable
Is there any way that a running process can delete its own executable?
For example, I make a console application (single exe) and after doing some tasks it somehow deletes the exe file.
I have to ...
19
votes
5answers
13k views
How can we check if a file Exists or not using Win32 program?
How can we check if a file Exists or not using a Win32 program? I am working for a Windows Mobile App.
2
votes
5answers
5k views
How to check if a file is already open by another process in C?
I see that standard C has no way of telling if a file is already opened in another process. So the answer should contain several examples for each platform. I need that check for Visual C++ / Windows ...
30
votes
8answers
15k views
Command line tool to delete folder with a specified name recursively in Windows?
I want to delete every "_svn" in every folder and subfolder...
For example
c:\
proyect1
_svn
images
_svn
banner
_svn
buttons
_svn
Then I run something like
...
5
votes
2answers
2k views
Reading Windows file summary properties (title, subject, author) in Java
If you right-click on a file in Windows and select Properties, you can manage some properties in de Summary tab, such as Title, Subject and Author, like in this example:
I'm trying to find a way to ...
13
votes
4answers
3k views
Creating big file on Windows
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 ...
4
votes
6answers
15k views
How do I delete old files from a directory while keeping the most recent ones on Windows [duplicate]
Possible Duplicate:
Batch file to delete files older than N days
I want to run a scheduled windows task that deletes all files from a directory that are older than 2 weeks.
The reason is ...
4
votes
2answers
4k views
“listening” to file changes in C/C++ (on Windows)
Is their any way I can target a certain file and be able to receive all changes that are made to it?
Such as a file called Names.txt. Could I watch that file for names added? and then write them to ...
1
vote
1answer
2k views
windows batch file with goto command not working
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 ...
0
votes
5answers
972 views
saving a records containing a member of type string to a file (Delphi, Windows)
I have a record that looks similar to:
type
TNote = record
Title : string;
Note : string;
Index : integer;
end;
Simple. The reason I chose to set the variables as string (as ...
22
votes
9answers
32k views
How to create an empty file at the command line?
How to create an empty file at the DOS/Windows command-line?
I tried:
copy nul > file.txt
but it always displays that a file was copied.
Is there any other method in the standard cmd?
It ...
7
votes
6answers
5k views
Python windows File Version attribute
Last time I asked a similar question but that was about svn related versioning info. Now I am wondering how to query windows "File version" attribute about eg. a dll. I payed attention to wmi and ...