![]() If the content you want to archive is in the home directory of the user - it should be: ssh loginnamehostname tar cvf archive-name. ssh userhost tar -C direcotry -czf files/directory. If this was Windows I could just zip up the directory and it would create one archive, containing all files and folders recursively and preserving the path structure. If you want to compress it, add the -z or -j arguments to the recommendations above. I don't have the option to install anything on this Unix server, such as a different version of tar. This compresses the directory into one archive file that fits inside my home folder, but doesn't preserve the path structure, so I end up with all the files and directories in the root of the archive. I've also tried redirecting the output to gzip: tar cvf - /path/dirtocompress | gzip > ![]() If I run it with the "z", I just get the "tar usage" output to the console, indicating it doesn't understand it. We can use different compression techniques to get a compressed output. The Compress-Archive cmdlet creates a compressed, or zipped, archive file from one or more specified files or directories. If I try the above command without the "z", it works without compression - but the file gets truncated because I don't have enough space in my home directory to store the file uncompressed (the space available is set by a restriction that I have no control over, not by not having enough available disk space). By default, tar only archives the files without compression but using some portions. For example, to locate file50. Add the file name (or names) after the command: tar tf .The -t option to list files in an archive is handy for locating specific files. I need to keep the directory/file structure.Īll the help I can find says to use something like tar -cvfz /path/dirtocompressīut I have no "z" option available - if I just type tar at the console, it gives me the usage details but there's no "z" option. There are two ways to locate specific content using tar: 1. ![]() ![]() In x mode, change directories after opening the archive but before extracting entries from the archive. I have a directory on a Unix server that I need to compress (recursively, including all files and directories) into one archive file, that I can FTP to my Windows box. You can use the -C option of tar to accomplish this: tar -C /home/username/dir1/dir2 -cvf temp.tar selecteddir From the man page of tar: -C directory In c and r mode, this changes the directory before adding the following files. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |