0

Relating to a previous question of mine...

win32file.ReadDirectoryChangesW doesn't find all moved files (Relative code is in there)

Is there a way to actually wait for a notification that all drag and dropped files have been moved or copied? I am currently utilizing win32file.WaitForSingleObject(*args, **kwargs) to attain each individually dropped file. This is not beneficial when I need to detect a wide range of files at varying amounts (I need to detect how many files had been dropped).

I have tried utilizing win32fil.WaitForMultiplObjects(*args, **kwargs), but does not seem to provide the actual amount (I cannot seem to figure out how to read the total that had been transferred or read that anything was moved in totality, it continues to only read each one as it moves). I also cannot determine when the detection ends (when the files have finished moving, totally). The result of what I want, is to detect all of them together, to inevitably create a queue (file management). For example, when you move 10 files from one directory to another, a progress window pops up alerting you of how many are being moved (10). I need to detect the amount in Python, but only AFTER the files have moved.

Thank you, Sir James

SirJames
  • 387
  • 8
  • 27
  • Sorry. I misspoke. I'm looking to have my tool detect all drag and dropped files - wait for a notification that they've all finished being moved or copied. The sarcasm, though, is nonconstructive and unappreciated. @martineau – SirJames Sep 05 '18 at 16:44
  • @martineau You've missed the point. I'm not asking to detect whether or not a user is going to drag and drop, I'm looking for the actual finalized movement. Consider, a user moves 10 files from one location to another, I was detecting all that individually. I'm asking if there's a way to detect the entirety of that. Windows sees it (a progress bar pops up), how do I see it in Python? What's desired isn't impossible, especially if you don't understand or read the question. – SirJames Sep 05 '18 at 23:11
  • 1
    OK, I've retracted my close vote. You certainly didn't make what you wanted clear _in your question_ which is where it matters the most. What you want to do will only be possible if Windows broadcasts some system-wide message that applications other than Explorer can see or detect. If you can identify the Win API you need to interface to/with, it can probably be done in Python. I suggest you try asking the question on some Windows-centric forum. – martineau Sep 06 '18 at 07:26
  • @Martineau Alright, I'll see what I can scrounge around elsewhere. I thought I asked it appropriately, but I was in a rush yesterday so that is definitely my fault for not clearly (100%) providing that question. However, with my example (from the other project), it should've filled in some of the holes. – SirJames Sep 06 '18 at 10:35
  • I've updated the question to more appropriately reflect what I was trying to ask. I apologize about the confusion. – SirJames Sep 06 '18 at 10:45
  • 1
    You'd have to monitor each subdir individually, and call `read_dir_changes` for each of them passing an `pywintypes.OVERLAPPED()` instance. Then, you could `WaitForMultipleObjects` on the above instances. – CristiFati Sep 06 '18 at 12:22
  • The code from https://stackoverflow.com/questions/49799109/win32file-readdirectorychangesw-doesnt-find-all-moved-files#49888600 could be "broken up in pieces". I made it "editable", but I didn't imagine such a scenario. Anyway, it can be nicely wrapped up. – CristiFati Sep 18 '18 at 01:26

0 Answers0