This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TARGET_DIR = '/full/path/to/dir/containing/dirs/to/reduce/' | |
TARGET_DIR_LEN = len(TARGET_DIR) + 1 | |
CURRENT_DEPTH = 6 | |
DESIRED_DEPTH = 2 | |
last_dir = '' | |
for dirname, _, filenames in os.walk(TARGET_DIR): | |
path = dirname[TARGET_DIR_LEN:].split('/') | |
if filenames and len(path) >= CURRENT_DEPTH: | |
cur_dir = '/'.join(path[:DESIRED_DEPTH - CURRENT_DEPTH]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Autosave plugin for CKEditor (requires jQuery) | |
* | |
* CKEDITOR.config.autosave_delay - delay in seconds before request is sent (located in config.js) | |
* #AUTO_SAVE_URL - input (usually hidden) with save url (located on the page) | |
* | |
* Server's supposed to send back {status: ok|error, (optional message: text)} | |
* | |
* Place it in plugins/autosave directory | |
* @author Boris Shemigon <i@boris.co> |