New answers tagged


@nohillside 's answer above is great actually. The only issue with it is that it does not account for files with spaces in them. That will cause some of the commands to fail. So I'm putting an answer here that would support that as well. This will just echo out the mv commands: find . -type f -exec sh -c 'for f do x=${f#./}; y="${x// /_}"; echo "mv ${x// /...


Try this: find . -type f -print0 | xargs -0 md5 -r Note -print0 and -0 to handle spaces in filenames. Compared to find . -type f -exec, this solution runs md5 much less frequently, although this might not have a measurable impact.


find . -type f -exec /sbin/md5 -r {} + ^^^^^^^ ^^^^^ ^^^^^^^^^^^^ ^^ ^ | | | | | | | | | +- add as many file names as possible per call | | | +---- replace with names of found files | | +------------ command to run | +-------------...


The following is a proof of concept to show how I'd build out the target_directory and target_filename from the source_filename, based on information in your OP and comments: $ ls -1 DSC_0008.JPG DSC_0034.JPG DSC_0077.JPG DSC_0132.JPG codetest $ cat codetest #!/bin/bash find . -type f -iname '*.jpg' -size +500k -exec sh -c ' i=7398 for f in "$@"; do m=...


In the recent macOS version (10.14), sips -i icon.png will get a --addIcon is no longer supported error. It also needed Developer Tools installed. This takes the graphic in Icon.png and applies it to file.ext, just like user588's answer: # Covert Icon.png to tempicons.icns: sips -s format icns Icon.png --out tmpicns.icns # Create temp resource file which ...


It should be noted that if you aren't accustomed to using vim (the default crontab editor) then you can specify your editor as follows: export VISUAL=nano; crontab -e

Top 50 recent answers are included