I want to append a string to each file printed by the find command . It prints each file on a new line. The thing is that each file has a unique string to be appened to its name. This is how i need it to work
Run the find command Print the first result Have a read prompt for user to enter string , then append that string to the name. Print the second result. Have a read prompt .. then append that string to the second name ... and so on for all of the files
I have tried using while loop to do this , although haven't been successful yet
find . -type f -name 'file*' | while IFS= read file_name; do read -e -p "Enter your input : " string mv "$file_name" "$file_name $string" done For example. Lets say the original filename is demo1.mp4 , and i enter 'test' in the read prompt , then the filename should be renamed to 'demo1 test.mp4' ( There should be a space before appending the string to the end of filename )