file-copying

Python: copy long file path Shutil.copyfile

感情迁移 提交于 2019-12-02 07:14:55
I want to copy too long paths with python using shutil.copyfile. Now I read this Copy a file with a too long path to another directory in Python page to get the solution. I used: shutil.copyfile(r'\\\\?\\' + ErrFileName,testPath+"\\"+FilenameforCSV+"_lyrErrs"+timestrLyr+".csv") to copy the file but it gives me an error : [Errno 2] No such file or directory: '\\\\?\\C:\\... Can anyone please let me know how to incorporate longs paths with Shutil.copyfile, the method I used above should allow 32k characters inside a file path, but I cant even reach 1000 and it gives me this error. Since the \\?\

How to know a file is finished copying

久未见 提交于 2019-12-02 04:55:54
问题 I’m using ReadDirectoryChangesW to spy a folder, if I’m copying a large file to the folder, I can receive multiple FILE_ACTION_MODIFIED messages, it seems each time windows writes a large chunk of the file, you get the file modified notification for each time. I tried to use CreateFile API to check if the file can open by AP or not, but sometime, some of files are always locked by other AP, for example, if you are opening the Outlook, the PST will update, but my AP can’t access it, we have to

Executable getting somehow corrupted when being copied

那年仲夏 提交于 2019-12-02 04:52:42
问题 I'm using Qt's QNetworkAccessManager to download a file from a place (currently the local machine, but in the future it will be an HTTP server) and temporarily store it in the TEMP file (linux ubuntu). The problem I've found is that the file (which is an executable) gets corrupted in the process: when I try to run the file as executable, it returns a classical error of problematic cross-compilation. Now that's interesting because the file is a executable for a Embedded Linux Device - I'm

How to know a file is finished copying

无人久伴 提交于 2019-12-02 02:52:50
I’m using ReadDirectoryChangesW to spy a folder, if I’m copying a large file to the folder, I can receive multiple FILE_ACTION_MODIFIED messages, it seems each time windows writes a large chunk of the file, you get the file modified notification for each time. I tried to use CreateFile API to check if the file can open by AP or not, but sometime, some of files are always locked by other AP, for example, if you are opening the Outlook, the PST will update, but my AP can’t access it, we have to start Shadow Copy to open it. So my question is, how to know a file is finished copying? This is a

Executable getting somehow corrupted when being copied

蓝咒 提交于 2019-12-02 00:52:01
I'm using Qt's QNetworkAccessManager to download a file from a place (currently the local machine, but in the future it will be an HTTP server) and temporarily store it in the TEMP file (linux ubuntu). The problem I've found is that the file (which is an executable) gets corrupted in the process: when I try to run the file as executable, it returns a classical error of problematic cross-compilation. Now that's interesting because the file is a executable for a Embedded Linux Device - I'm downloading the executable to my TEMP so I may send it later to the device. When that happens (using

Why copying to system32 automatically copies to sysWOW64 instead?

风流意气都作罢 提交于 2019-12-01 18:10:37
I'm trying to copy a file to C:\windows\system32 by calling CopyFileA - debugging shows that indeed the string "C:\windows\system32\filename" is sent to CopyFileA, but my file is copied to "C:\windows\system32\sysWOW64\filename" instead. Does anyone know why does that happen? On 64bit Windows, Windows does filesystem redirection for 32bit processes. To disable, call Wow64DisableWow64FsRedirection For the app to also run on 32bit Windows XP, Wow64DisableWow64FsRedirection must be dynamically linked at run-time. Here is the code I use: BOOL DisableWow64FsRedirection(PVOID* OldValue) { #ifdef

Inno Setup - FileCopy use wildcard character in pathname

*爱你&永不变心* 提交于 2019-12-01 10:44:18
I'm trying to copy all database files over from a previous installation to a new installation, which has a new pathname. The problem is that the installer will not know the names of the database files, so I'm trying to use a wildcard character. I tried using TFileStream.Create(), but this was searching for a single file, such as "*.mdb", and I kept getting an error saying it couldn't find that file. I also tried using FileCopy(), but it seems to simply fail and move on. I even tried using Exec() to run it through command line, but it would just freeze the installation. I've searched online a

Inno Setup - FileCopy use wildcard character in pathname

可紊 提交于 2019-12-01 09:19:28
问题 I'm trying to copy all database files over from a previous installation to a new installation, which has a new pathname. The problem is that the installer will not know the names of the database files, so I'm trying to use a wildcard character. I tried using TFileStream.Create(), but this was searching for a single file, such as "*.mdb", and I kept getting an error saying it couldn't find that file. I also tried using FileCopy(), but it seems to simply fail and move on. I even tried using

Python: copy long file path Shutil.copyfile

醉酒当歌 提交于 2019-12-01 08:36:04
问题 I want to copy too long paths with python using shutil.copyfile. Now I read this Copy a file with a too long path to another directory in Python page to get the solution. I used: shutil.copyfile(r'\\\\?\\' + ErrFileName,testPath+"\\"+FilenameforCSV+"_lyrErrs"+timestrLyr+".csv") to copy the file but it gives me an error : [Errno 2] No such file or directory: '\\\\?\\C:\\... Can anyone please let me know how to incorporate longs paths with Shutil.copyfile, the method I used above should allow

Copying Files Recursively

强颜欢笑 提交于 2019-12-01 07:31:50
I found a small snippet for doing a recursive file copy in C#, but am somewhat stumped. I basically need to copy a directory structure to another location, along the lines of this... Source: C:\data\servers\mc Target: E:\mc The code for my copy function as of right now is... //Now Create all of the directories foreach (string dirPath in Directory.GetDirectories(baseDir, "*", SearchOption.AllDirectories)) { Directory.CreateDirectory(dirPath.Replace(baseDir, targetDir)); } // Copy each file into it’s new directory. foreach (string file in Directory.GetFiles(baseDir, "*.*", SearchOption