How To Zip A File In Linux And Exclude Directory Files
RegisterLogin
How To Zip A File In Linux And Exclude Directory Files
Post Description: i have a windows xp laptop and i want to be able to download an important backup, but i can't open the tar files, so i want to create a zip file, but there is a directory which i dont need to zip, so i want to exclude it so when the zip command runs, i ig
Tags: who, to, zip, a, file, in, linux, and, exclude, directory, files
This Post Was Posted On Oct 03, 2012 By Lesli #3573
Post Description: i have a windows xp laptop and i want to be able to download an important backup, but i can't open the tar files, so i want to create a zip file, but there is a directory which i dont need to zip, so i want to exclude it so when the zip command runs, i ig
Tags: who, to, zip, a, file, in, linux, and, exclude, directory, files
This Post Was Posted On Oct 03, 2012 By Lesli #3573
How To Zip A File In Linux And Exclude Directory Files by Lesli
i have a windows xp laptop and i want to be able to download an important backup, but i can't open the tar files, so i want to create a zip file, but there is a directory which i dont need to zip, so i want to exclude it so when the zip command runs, i ignores that particular folder. how do i do it?
Leave Your Comments
Related Pages: [Add Your Website]
Post New Topic
webune support
#4512 1
lest say you have a directory which you want to zip, for example, the directory is called, backup and there are two sub-directories called 'include' and 'exclude'
../backup
./include
./exclude
to run the command to only include the 'include' the files in the 'include' directory and not put the 'exclude' directory in your zip file, you can run this command to create a file called MyBackups.zip from the
another example:
zip -r MyBackups.zip PathToDirectory/* -x PathToDirectory/.gif\* directoryrname/private\* PathToDirectory/exclude.html
as you can, these command help in excluding files and folders which you dont want to include in your zip command
also, if you need more help you can run the man zip command and you should get more information like this:
../backup
./include
./exclude
to run the command to only include the 'include' the files in the 'include' directory and not put the 'exclude' directory in your zip file, you can run this command to create a file called MyBackups.zip from the
zip -r MyBackups.zip /path/to/backup/* -x path/to/backup/exclude\*
another example:
zip -r MyBackups.zip PathToDirectory/* -x PathToDirectory/.gif\* directoryrname/private\* PathToDirectory/exclude.html
as you can, these command help in excluding files and folders which you dont want to include in your zip command
also, if you need more help you can run the man zip command and you should get more information like this:
-x files
Explicitly exclude the specified files, as in:
zip -r foo foo -x *.o
which will include the contents of foo in foo.zip while excluding all the
files that end in .o. The backslash avoids the shell filename substitution,
so that the name matching is performed by zip at all directory levels. If
you do not escape wildcards in patterns it may seem to work but files in
subdirectories will not be checked for matches.
Also possible:
zip -r foo foo -x@exclude.lst
which will include the contents of foo in foo.zip while excluding all the
files that match the patterns in the file exclude.lst (each file pattern on
a separate line).
Explicitly exclude the specified files, as in:
zip -r foo foo -x *.o
which will include the contents of foo in foo.zip while excluding all the
files that end in .o. The backslash avoids the shell filename substitution,
so that the name matching is performed by zip at all directory levels. If
you do not escape wildcards in patterns it may seem to work but files in
subdirectories will not be checked for matches.
Also possible:
zip -r foo foo -x@exclude.lst
which will include the contents of foo in foo.zip while excluding all the
files that match the patterns in the file exclude.lst (each file pattern on
a separate line).
Oct 08, 2010 Reply Report abuse
©2012 Webune Forums - Wed Oct 03, 2012 12:52 pm
Powered by: Webune Forums V3
Powered by: Webune Forums V3