How to use command zip in linux that folder have short path? -
i used command zip in linux (redhat), command:
zip -r /home/username/folder/compress/zip.zip /home/username/folder/compressed/*
then, open file zip.zip, see architecture path folder compress.
i want in folder zip consist list file *.txt
because used command in script crontab hence can't use command cd path folder before run command zip
please me
i skimmed zip man page , have found. there not option archive files relative different directory. closest have found zip -j
removes entire path , stores files directly in zip rather sub directories. not know happens in case of file name conflicts such if /home/username/folder/compressed/a.txt
, /home/username/folder/compressed/subdir/a.txt
both exist. if not problem you, can use option, concerned because did specify -r
option indicating expect zip traverse sub folders.
i thought of possibility script somehow call zip different working directory, took @ unix stack exchange page , looks options use cd
.
i have admit not understand why cannot use cd
, curious it. said using crontab, have never heard of wrong changing directories in crontab script.
Comments
Post a Comment