I am looking for a fast way to calculate the size of a folder in Python on Windows. This is what I have so far:
def get_dir_size(path):
total_size = 0
if platform.system() == 'Windows':
try:
items = win32file.FindFilesW(path + '\\*')
except Exception, err:
return 0
# Add the size or perform recursion on fold...
I have a webpage hosted on a Windows box that I need to assure gets loaded at least once/day. My current plan is to create a scheduled task that opens Internet Explorer and hits the URL:
"C:\Program Files\Internet Explorer\iexplore.exe" myurl.com/script_to_run_daily.aspx
This was simple to setup and works fine, but it strikes me as a ...
How can I check in a PHP script if it's running in a windows or unix environment?
...
When writing file paths in C#, I found that I can either write something like "C:\" or "C:/" and get the same path. Which one is recommended? I heard somewhere that using a single / was more recommended than using \ (with \ as an escaped sequence).
...
Is there a Windows native API analogous to pthread_cancel, pthread_testcancel etc?
If not, how can we simulate cancelling of one thread from another using the pthread_cancel mechanism in Windows?
...
Windows Mutex seems to allow an acquired lock to be acquired again (recursively) if the thread currently owning the lock tries to acquire it.
But, posix based pthread locks don't allow such a behaviour.
Is there any compile time macro or any settings which can make the windows mutex behave in the same way as the pthread mutex?
...
I have a program (jhead) that compiles with very few tweaks for both Windows and generic Unix variants. From time to time, windows users ask if it can be modified to also set the "creation date/time" of the files, but I don't see a way to do this with the POSIX api. What I'm currently doing is:
{
struct utimbuf mtime;
mtime....
Hello,
When, for example, i want a batch file to 'open' a file. when i for example drag and drop the file into the batch file, it should do some stuff with that file.
Now, i need to know the variable. I know there is a variable for this kind of stuff; i just forgot it.
Can someone give me the variable please?
Thanks.
...
Hello,
I am coding a batch file. Here is a sample:
if exist rootsys.txt del rootsys.txt
if %lang%==1 (
if %bit%==32 echo C:\Program Files\path\to\the dir>rootsys.txt
if %bit%==64 echo C:\Program Files(x86)\path\to\the dir>rootsys.txt
goto :waset
)
This goes on for six times (so if %lang%==2 etc... to if %lang%==6.)
So, what it does,...
I have an application where I need to check emails as they come, however using POP3 to poll an email server is a major pain.
Ideally I'd just like to setup an email server and write a plugin for it to handle some sort of EmailReceived event, that contains all the headers and content of the e-mails received.
I'm not looking to create an...
I'm running the below code and I expect the mouse to move to the center of the currently active window when I hit comma.....instead it is moving to different points on the screen, depending on where the window is on the screen. It only centers the mouse properly when the window is positioned at the top left (x=0, y=0).
#NoEnv
SendMode ...
I'm reading Computer Programming Using GNU Smalltalk, but I want to know with is the best program to write my Smalltalk sources, because I don't know if I use Notepad++, a editor or a IDE, then I want a suggestion for a beginner.
Remember that I'm using Windows XP.
...
Hello,
I've been looking at the windows 7 symlinks (using mklink) [Ed.- they are also supported on Vista, WS2003, WS2008], and I was wondering if it were possible to programmatically determine if a folder were a symlink. Thanks for any help.
~ Steve
...
Perhaps I'm missing a major point of the x64 platform here, but my perception was that x64 applications were only better performing than x86 versions (on an x64 OS and hardware, obviously) when large amounts of memory, large pointers, or other demanding factors were involved.
However, I've started to notice some smaller applications off...
Hi,
I want to check for the existence and if it doesn't exist add some actions in the Explorer's right click (context) menu.
Besides of the above requirement (for which one can find easily solutions on web) I want to add one more:
Suppose that I register the following commands:
"Command #1" - triggers 'C:\MyProg.exe /cmd1'
"Command ...
Consider if I have got a Package in my C:\x\y\z and another package in D:\m\n\o.
How can I access them in my java program? Do I need to set any path?
...
And how?
I want to implement an simple enough dialog with several buttons.
...
Hello,
Recently i posted a question about what the variable is of a file which you open with a batch file, which is %1.
I used this, to let my batch file copy %1 to a specific location.
After doing this, debugging and a lot of time, and it actually worked, after debugging it more, adding some features, and some more debugging, it stopp...
I'm trying to modify the behavior of an IDispatch interface already present in the system.
To do this my plan was to hook into the objects v-table during runtime and modify the pointers so it points to a custom hook method instead.
If I can get this to work I can add new methods and properties to already existing objects. Nice.
First I...
Hello,
Let's say, the user drag and drops an file into my batch file, which causes that the batch file copies the file to a certain directory. the problem is the following command:
copy "%1" "C:\path\to\it"
The problem here is the quotes around%1. When you drag and drop something in a batch file, normally, it wouldn't put quotes, so ...