…My only grip is that when you open the zip file, the parent directories are there too.
So within the zip file I have to navigate through “/root/Desktop/administration” just to get to the directory called backup.
Is there a way for me to zip the directory backup, and not include the parent directories? I want to be able to open the zip file and see only the backup directory listed.
PS. /root/Desktop seems a strange place to me to use for anything. Because root NEVER logs in in the GUI and that directory should accordingly never be used for it’s real purpose.
Do you mean that my solution does not work either?
And when you want to give us usefull information, please do not TELL what you see, but SHOW what you see by copy/paste of the command and it’s output here in a post (of course between CODE tags: Posting in Code Tags - A Guide). Then there can be no misunderstanding about what happens.
zip -jr /root/Desktop/backupqueue/txhttp/$(date +%F).zip /root/Desktop/rsyc_cache/txhttp/
and here is the error I get:
zip warning: name not matched: /root/Desktop/rsyc_cache/txhttp/zip
zip warning: name not matched: /root/Desktop/backupqueue/txhttp/2011-05-11.zip
zip warning: name not matched: /root/Desktop/rsyc_cache/txhttp/
zip error: Nothing to do! (try: zip -jr /root/Desktop/backupqueue/txhttp/2011-05-11.zip . -i /root/Desktop/rsyc_cache/txhttp/zip -jr /root/Desktop/backupqueue/txhttp/2011-05-11.zip /root/Desktop/rsyc_cache/txhttp/)
-bash: 2011-05-11: command not found
zip warning: first full name: /root/Desktop/rsync_cache/txhttp/orion/.htaccess
zip warning: second full name: /root/Desktop/rsync_cache/txhttp/orion/admin/.htaccess
zip warning: name in zip file repeated: .htaccess
zip error: Invalid command arguments (cannot repeat names in zip file)
…I find it weird that it would have issues with .htaccess now since it works fine with just the -r option.
Not per se. It is on of those urban legends that is given down from one innocent noob to the next. Those people may however be very much up to date on other subjects. rotfl!
It was that way in the Bourne shell. Allready the Korn shell (about 25 years ago) offered the $( … ) feature, which has imho the advantages that it
. is better readable (especialy when a command/script also uses a multitude of ’ and " quoting;
. can be nested.
Actually according to the bash man page you can nest backticks also, by escaping them with , but I’m not interested in using this feature. Presumably if you want to nest on the second level, you would need to escape the \ too. Getting too much like watching Inception. Try this:
Yep, works. I doubt if this works in the Bourne shell (but who has a Bourne shell nowadays). And since the Korn shell I happily use the $( … ). No incentive to go back because the readability of