Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I am having problems with tar. If I use the command
tar czf "/home/user/Desktop/backup.tar" "/home/user/Desktop/documents"
it creates a tar file, but it also includes the folder structure "/home/user/Desktop/documents". How do I stop it from creating the folder structure in the tar file and only compress the files/folders I want without having to click through the whole folder structure to get to the backup files?
Last edited by mashcaster; 01-03-2009 at 05:09 AM.
Reason: SOLVED
That doesn't really work either, it creates a folder with a . and puts the files in that folder. Will tar not allow archive to start without creating a folder?
That doesn't really work either, it creates a folder with a . and puts the files in that folder. Will tar not allow archive to start without creating a folder?
Don't include the directory in the command line. "." is a directory
Use "*" to mean "all files in current dir" instead. You should also check shopt and the dotglob option if you intend to pack the hidden files in that dir (if any).
PS. However I can't see a problem with having ./ in front of your files in the tar file... The effect will be the same.
Don't include the directory in the command line. "." is a directory
Use "*" to mean "all files in current dir" instead. You should also check shopt and the dotglob option if you intend to pack the hidden files in that dir (if any).
PS. However I can't see a problem with having ./ in front of your files in the tar file... The effect will be the same.
That seems to give me an error:
Quote:
mashcaster@mashcaster-desktop:~$ tar -C /home/mashcaster/Desktop/backupthis/ --exclude=backup.tar -cf /home/mashcaster/Desktop/backupthis/backup.tar *
tar: abusesingingspe00yeargoog_meta.xml: Cannot stat: No such file or directory
tar: Arabic Basics: Cannot stat: No such file or directory
tar: Desktop: Cannot chdir: No such file or directory
tar: Error is not recoverable: exiting now
mashcaster@mashcaster-desktop:~$
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.