windows:keepingtempworkorganized
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| windows:keepingtempworkorganized [2011/12/29 10:50] – creado rlunaro | windows:keepingtempworkorganized [2022/12/02 21:02] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Keeping your temporary documents organized ====== | ||
| + | |||
| + | I do a lot of temporary documents: just elaborate them to send them by email, or analyze them (log files), extract conclusions (drop them in a word document) and therefore send them back by email. These things creates a lot of files that only need to be kept some days. | ||
| + | |||
| + | To save them, I developed the following method: I have a temp dir --let' | ||
| + | |||
| + | The problem arises when downloading files from internet or uploading files in my email client: I have always to change the location of the files: picking '' | ||
| + | |||
| + | To solve this, I've created a '' | ||
| + | |||
| + | * check for existence of the dir '' | ||
| + | * if exists, check if it is older (date saved different from today' | ||
| + | * if it is, it will be moved to the proper day (if it was created on 12/01, it will be moved to the '' | ||
| + | |||
| + | ===== Source code of batch file ===== | ||
| + | |||
| + | <code dos> | ||
| + | rem @echo off | ||
| + | |||
| + | set temp=c: | ||
| + | set destdir=c: | ||
| + | set token=c: | ||
| + | |||
| + | if exist %token% goto file_exists_move_dir | ||
| + | |||
| + | : | ||
| + | |||
| + | rem if dir exist, skip creation and save date | ||
| + | if exist %destdir% goto skip_dir_creation | ||
| + | |||
| + | mkdir %destdir% | ||
| + | |||
| + | date /t > %token% | ||
| + | |||
| + | : | ||
| + | |||
| + | goto end | ||
| + | |||
| + | : | ||
| + | |||
| + | rem try to read content of temp\now\.token | ||
| + | for /f " | ||
| + | |||
| + | rem read current day | ||
| + | for /f " | ||
| + | |||
| + | if %cur_day% == %saved_day% goto skip_renaming | ||
| + | |||
| + | rem move directory %destdir% to %saved_day% | ||
| + | rename %destdir% %saved_day% | ||
| + | |||
| + | : | ||
| + | |||
| + | goto create_dir_save_token | ||
| + | |||
| + | :end | ||
| + | |||
| + | rem hemos acabao, abrir explorador en %destdir% | ||
| + | start " | ||
| + | |||
| + | </ | ||
| + | |||
