Created
June 12, 2019 07:27
-
-
Save seenimohamed/1666da0efb226ea2ea6d6a13005a34c8 to your computer and use it in GitHub Desktop.
Power of find command in terminal
This file contains 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
#!/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