Created
          October 24, 2022 03:39 
        
      - 
      
- 
        Save msymt/69923a74a66c012e9595a7221ef3c596 to your computer and use it in GitHub Desktop. 
    xxd対象のファイル名とその結果を順に表示するプログラム
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import glob | |
| import subprocess | |
| dir = "/path/to/dir" | |
| files = glob.glob(dir + "*") | |
| files.sort() | |
| for file in files: | |
| r = subprocess.run(["xxd", file], stdout=subprocess.PIPE) | |
| with open("output.txt", "a") as f: | |
| f.write(file + "\n") | |
| f.write(r.stdout.decode("utf-8")) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment