
Dropbox is just great service. Free 2 gigabytes, synchronization between multiple computers and mobile devices under different operating systems. And how many different applications national craftsmen find for him are not to count - this is automation of torrent downloads, business card sites, and even software RAID arrays.
However, such a simple task of sharing files with an unregistered user will be very costly: you will have to give a link to each file (after placing them in the Public folder) that you want to transfer. Therefore, you will surely use either one of the well-known file sharing services or simple e-mail. But why not organize such file hosting with a convenient interface in your Dropbox?
Those familiar with the Dropbox Public folder know that public links to files completely preserve relative file paths. They have the form
dl.dropbox.com/u/user_id/{___public}
. This fact is used when creating websites and business cards on Dropbox. But let us assume that there are quite a large number of files and folders with a rather complex structure that I would like to share. Moreover, not necessarily all the files, and offer to choose the user exactly what he needs. The logical solution is to create a "file map" with the corresponding addresses and links to files. But how to create a complete directory tree with the necessary links? In Linux, the tree command with the -H key will come to the rescue. In Windows, there are no built-in tools for this (yes, there is also a tree command here, but it does not know how to substitute links). Of course, you can try to write your own recursive script that will emulate the Linux tree -H: navigate through folders, substitute links, output all of this to a file, but let's agree that someone does not have enough skills and knowledge, and sometimes just not enough time to write, debug and support.
')
One of the solutions we offer a user Dropbox
Eliphas Q. and his brainchild - pyndexer.
What is pyndexer?
Pyndexer is a Python script that creates a list of your files that are in the Public folder.
The script recursively examines the folders specified in the settings file and creates index.html files in each directory. The created files are picked up by Dropbox itself and synchronizes with the cloud. Thus, each folder in the pyndexer view is a separate index.html file, between which the navigation takes place (such a kind of personal FTP in the Dropbox cloud).
The script supports a large number of file types, and you can add your own, slightly modifying the code. In addition, he can ignore some of the folders or close access to them with a password, the built-in jwplayer can play audio and video files (default mp3 and mp4), as well as attach the readme to the footer listing page. Even if this is not enough, you can also screw Google Analytics.
How to start using?
The script works successfully in Linux, Mac OS X and Windows (I didn’t want the compiled .exe to work, so I needed to install the Python environment).
Installing on Linux:
cd ~/Dropbox/Public wget http://dl.getdropbox.com/u/552/pyndexer/pyndexer.py chmod +x pyndexer.py python pyndexer.py
Installation in Windows:
1. In the absence of a Python environment, we load the compiled
.exe . Otherwise, we just need the
script itself.
2. Run in the Public folder.
After launching, the script will download the pyndexer.ini configuration file and the pyndexer.template.html template for itself. Directly in pyndexer.ini, you need to specify the absolute path to the Public folder (this is necessary because of the encryption of the paths in Dropbox 1.2.x and higher), and also in square brackets the relative paths of the directories to be indexed.
For example, I want to index two folders (Somethings and Savegames), but I want to put the password on Somethings, and not index the subfolder NotSoPublic; and in the folder Savegames, I want to show the text after the list of files, which is in another file sometext.txt. Then in the pyndexer.ini file you should specify:
[Somethings] password=ItsSecret [Somethings/NoSoPublic] skipdir=yes [Savegames] readme=sometext.txt
It should be noted that passwords are stored in the open, so such storage is very insecure, because you can easily access the configuration file by simply substituting the path into the address bar.
You can also invite referrals (Dropbox logo at the top of the file list). The link is controlled by the dropbox_referrer parameter in the pyndexer.ini file.
After the end of the script, we give a link (public link) to index.html in any directory and use a pleasant web interface in the style of Dropbox.
A full description of the script and possible difficulties in the work can be found in the
readme file from the author.
References:
- Demo from the author
- The script itself (version 1.2)
- Script readme
- Dropbox Discussion