A
A
aminodovborisov2021-10-10 20:13:35
Python
aminodovborisov, 2021-10-10 20:13:35

How to organize remote file sharing in Python?

Hello!
There is a file storage at https://111.111.111.111:1234/files/give/ . By clicking on the link https://111.111.111.111:1234/files/give/file1/download I can download file1 as a file.
There is another file storage, at https://222.222.222.222:4321/files/receive/ .
What I want:

  1. Request a list of files at https://222.222.222.222:4321/files/receive/ . As an array.
  2. Request a list of files at https://111.111.111.111:1234/files/give/ . Also in the form of an array.
  3. If there are files in the first storage that are not in the second, then copy the missing files from the first storage to the second.
  4. This way I have to access the files in the second storage. To do the same, follow the link https://222.222.222.222:4321/files/receive/file1/d... to download file1.

Can you please tell me how to do this?
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dmshar, 2021-10-10
@dmshar

Generally speaking, file storages have nothing to do with it. There are two lists - sp_fl_1 and sp_fl_2. The fact that these are the file names obtained in your steps 1. and 2. does not matter. We need to find elements in sp_fl_1 that are not in sp_fl_2.
s_diff=set(sp_fl_1)-set(sp_fl_2)
The s_diff variable contains a list of objects that are present in the first list but not in the second.
Well, then "pull" these files from the first "storage file", save them in the second - or whatever you want to do with them.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question