Skip to content

Instantly share code, notes, and snippets.

@seenimohamed
Created June 12, 2019 07:27
Show Gist options
  • Save seenimohamed/1666da0efb226ea2ea6d6a13005a34c8 to your computer and use it in GitHub Desktop.
Save seenimohamed/1666da0efb226ea2ea6d6a13005a34c8 to your computer and use it in GitHub Desktop.
Power of find command in terminal
#!/bin/sh
# Usage : move all mp4 files with removing extension
# Command to run :
# ./move_all_files_with_diff_name.sh <source_folder> <destination_folder>
# Command structure
# find . -name "*.mp4"
# normal find command
# find <loc to search> -name <files to search>
# -exec : execute the next command
# sh -c : execute as a shell script
# 'mv "$0" "${0%.*}"' '{}' ';'
# 'command "input" "inputModification"' '{input}' ';'
find . -name "*.mp4" -exec sh -c 'mv "$0" "${0%.*}"' '{}' ';'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment