function! Backup2UsbMemory(dir, compress)
if a:dir =~ '/$'
let l:dirroot = a:dir
else
let l:dirroot = a:dir .'/'
endif
let l:dirname = l:dirroot .strftime("%Y/%Y_%m/%d")
if isdirectory(l:dirname) == 0
if isdirectory(l:dirroot .strftime("%Y/%Y_%m")) == 0
if isdirectory(l:dirroot .strftime("%Y/")) == 0
call mkdir(l:dirroot .strftime("%Y/"))
endif
call mkdir(l:dirroot .strftime("%Y/%Y_%m"))
endif
call mkdir(l:dirname)
if expand('%') == ''
echo 'Vim only made a directory named "' .l:dirname .'/"'
return
endif
elseif expand('%') == ''
echohl ErrorMsg
echo 'Error: No file name'
echo 'Directory ' .l:dirname ." is already made."
echohl None
return
endif
let l:compformat = ''
if a:compress == 'gzip'
let l:compformat = '.gz'
elseif a:compress == 'bzip2'
let l:compformat = '.bz2'
endif
let l:extend = expand("%:e")
if l:extend != ""
let l:extend = "." .l:extend
endif
exec "w" l:dirname .'/'. expand("%:t:r")."_".strftime("%y%m%d_%H%M") .l:extend .l:compformat
endfunction