My task is to copy a massive amount of files using Python. Currently I've everything set and copying whole dir trees works fine. But I got stuck at duplicating pipe and block files. How can I duplicate such a file using Python only? Is it even possible?
Asked
Active
Viewed 285 times
3
-
1I'm not even sure what that would mean without more context. For example, how would you *copy* `/dev/zero` or `/dev/urandom`? – kojiro Oct 04 '13 at 00:50
-
Just think of writing a backup program. In UNIX/Linux and Windows you will find various special files, which you cannot copy right away. You have to recreate them somehow. That's what I'm asking. – Oktay Acikalin Oct 04 '13 at 13:14
1 Answers
0
I can think of two solutions here:
Use a switch in your code to identify and read the block or PIPE files and duplicate the files by copying to the the desired location in another file. For reference, you can use this link to base your solution on.
The only other way I can think of is either change the blocking
PIPEs
to non-blocking. For eg.,f = open('./myfile', 'w+') # does NOT block

lionelmessi
- 1,116
- 2
- 10
- 17
-
Hm.. it more likely looks like I should learn how to use os.mknod and such stuff. Thanks anyway! – Oktay Acikalin Oct 04 '13 at 13:57