Skip to content

Instantly share code, notes, and snippets.

@comstock
comstock / delete_from_zip.md
Last active February 13, 2020 19:46
ZIP: Delete files from zip archive
  1. Install p7zip sudo apt install p7zip-full
  2. command: 7z d 5039629.zip 5039629/\*.tif will delete all TIFF files from archive 5039625.zip.

R script

Delete all the TIFF and JP2 files from all of the zipfiles in the working directory.

library(tools)
@comstock
comstock / exiftool_preserve_orig_fileName.md
Created February 2, 2020 22:20
exiftool: write original file name to original filename to "OriginalFileName" tag

exiftool -artist=me c:/images

exiftool -OriginalFileName="picture_of_me.jpg" c:/images

@comstock
comstock / everythingSearch.md
Last active February 1, 2020 15:18
"Everything" search commands for searching files and directories

Find files with names that include "abc"

es -a-d abc

Find folders/directories with names that include "abc"

es -ad abc

Find files/folders/directories on the C-drive with names that include "abc"

es -path "c:" abc

@comstock
comstock / copyFile.R
Created January 31, 2020 13:25
Copy a file n number of times
pacman::p_load(
readr,
dplyr,
stats,
ggplot2,
scales,
RColorBrewer,
htmlTable,
RCurl,
reshape2,
@comstock
comstock / macApplications.command
Created January 19, 2020 20:49
command to, 1) generate a list of Mac apps, and 2) to delete references to files within the .app directory
sudo find /Volumes/Macintosh\ HD/Applications/ -iname "*.app" > ~/Desktop/applicationsListing.txt
sed "/.*app.*app/d" ~/Desktop/applicationsListing.txt > ~/Desktop/applicationsListing.txt
@comstock
comstock / fun_with_exiftool.md
Last active May 22, 2024 10:56
exiftool scripts, command line

Fun with Exiftool

Add an imageDescription to an image's Exif metadata

exiftool -imageDescription="EV photographs Tibetan book. #photogrammetry #imagingServices #Harvard #Library" imaging_0063.jpg

Look for specific image metadata values

  • Files in current dir
@comstock
comstock / html_image_gallery.md
Last active January 14, 2020 01:49
Command line tools for generating an HTML gallery of images in a directory
@comstock
comstock / gm_histogram.txt
Last active January 1, 2020 15:27
graphicsmagick: write out an image's histogram as a text file
gm convert <filename>.jpg -format histogram <filename>.txt
@comstock
comstock / md5sum_list_recurse
Created October 18, 2019 12:02
Create an md5 checksum log of a file system
find . -type f -exec md5sum '{}' \; > md5sum_20191017.txt
#!/bin/sh
# Note: this script uses exiftool
# init a couple of variables
ICC=""
COLORMODE=""
EXT="tif"
while [ $# -gt 0 ]
do