Showing posts with label bash. Show all posts
Showing posts with label bash. Show all posts

Thursday, May 14, 2020

Screen permission denied


Problem
Cannot make directory '/var/run/screen': Permission denied
Solution
sudo /etc/init.d/screen-cleanup start

Tuesday, October 10, 2017

Batch file process in linux bash


Batch process *.ext files

Template

$ find /path/ -name *.ext -exec sh -c 'command "$1"' _ {} \;

Example

print file names without extension
$ find /path/ -name *.ext -exec sh -c 'echo "${1%.*}"' _ {} \;
print base name (dirname), directory (dirname)
$ find /path/ -name *.ext -exec sh -c 'echo $(basename "$1")' _ {} \;

Batch convert *.ext to *.ext_bak

Template

$ find /path/ -name *.ext -exec sh -c 'convert "$1" "${1%.*}".ext_bak' _ {} \;

Example

convert egg to bam file
$ find /path/ -name *.egg -exec sh -c 'egg2bam "$1" -o "${1%.*}".bam' _ {} \;

Tuesday, September 6, 2016

batch process images

find '/home/jwangae/bundleroot/Viewer/public/user_drive2/575fc0536e7a72be4cbd6b68' -name "*.JPG" | while read file; do   convert "$file" -rotate 90 "$file"; done