Skip to main content
added 130 characters in body
Source Link
find /.example1 -name example*.txt" -type f -exec| mvawk -F\/ '{}' for(i=1;i<=NF-1;i++) { path=path$i"/.example1" } } END { print "mv "$0" "path"folder/folder"$NF \;}' | sh 

Do a find on all the example files in the directory and then executeparse the returned output using awk, forming a move command. that is executed with sh

find /.example1 -name example*.txt" -type f -exec mv '{}' /.example1/folder \; 

Do a find on all the example files in the directory and then execute a move command.

find /.example1 -name example*.txt" -type f | awk -F\/ '{ for(i=1;i<=NF-1;i++) { path=path$i"/" } } END { print "mv "$0" "path"folder/"$NF }' | sh 

Do a find on all the example files in the directory and then parse the returned output using awk, forming a move command that is executed with sh

Source Link

find /.example1 -name example*.txt" -type f -exec mv '{}' /.example1/folder \; 

Do a find on all the example files in the directory and then execute a move command.