A
A
AlessandrIT2019-06-23 12:32:16
Python
AlessandrIT, 2019-06-23 12:32:16

How to copy file to file using Python?

I'm working on a Python reworking of the old trick of hiding a file within a file.
In cmd it looks like this: "copy 1.jpg + 2.rar 3.jpg"
However, it can't be implemented in python.
Also, I can't find an implementation of this command in cmd.
Tell me, what are the options other than direct access to cmd from the script?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Borisov, 2019-06-23
@AlessandrIT

The end goal is not entirely clear. If you want another file to appear at the end of one file, then in Python you need to do this:
1. Read file 1, 2; (rb)
2. Calculate the length of file 1: (_lenght_)
3. Write file 1 to file 2 at the length offset of the first one. (wb)
if you need to call a program from cmd, then do not forget python.exe proga.py. Or add python to environment variables (Windows). It works on Linux by default.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question