Notice
                              
                          
                        
                          
                          
                            Recent Posts
                            
                        
                          
                          
                            Recent Comments
                            
                        
                          
                          
                            Link
                            
                        
                    | 일 | 월 | 화 | 수 | 목 | 금 | 토 | 
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 | 
| 12 | 13 | 14 | 15 | 16 | 17 | 18 | 
| 19 | 20 | 21 | 22 | 23 | 24 | 25 | 
| 26 | 27 | 28 | 29 | 30 | 31 | 
                            Tags
                            
                        
                          
                          - Matplotlib
- python
- Windows
- vim
- MAC
- cython
- GSL
- polyglot
- datascience
- vi
- LaTeX
- SSH
- HFS+
- gfortran
- mpi4py
- intel compiler
- arXiver
- portforwarding
- virtual
- Visual Studio
- openmp
- h5py
- jupyter
- hyperref
- conda
- HDF5
- c++
- tab space
- cygwin
- Anaconda
                            Archives
                            
                        
                          
                          - Today
- Total
Astro Coke
[Linux] create separate tar files from multiple folders (files) 본문
      Computer Setup
      
    [Linux] create separate tar files from multiple folders (files)
astrodoo 2021. 1. 19. 22:25source:
여러 폴더를 상응한 이름의 압축파일로 변환하기 위해서는 메크로가 필요하다.
e.g.)
\tmp1
\tmp2
\tmp3
--> tmp1.tar.gz tmp2.tar.gz tmp3.tar.gz
하지만 아래와 같은 간단한 명령어로 쉽게 바꿀 수 있다.
find tmp* -type d -execdir tar cvfz '{}.tar.gz' '{}' \;- The first argument is the directory you want to begin in, and find the folders (or files)
- Then we will restrict it to find folders only (-type d; if it is files, it should be -type f)
- The -execdir option allows us to run a command on each file found, executing it from the file's directory
- This command is evaluated as tar foloder_name.tar.gz folder_name, for example, since all occurrences of {} are replaced with the actual folder name. This command needs to be ended with \;
'Computer Setup' 카테고리의 다른 글
| [Jupyter] Shutdown by port number (0) | 2021.07.08 | 
|---|---|
| [Globus] Command-line Globus (in beluga cluster) (0) | 2021.05.17 | 
| [Mac] ahnlab safe transaction on Mac OSX (0) | 2020.12.18 | 
| [Git] git merge between master and branches (0) | 2020.10.12 | 
| [Jekyll] Dependency errors when gem bundles are updated (0) | 2020.08.21 | 
 
          