I want to remove a group of same extension files with different file name in different folders from my pen drive, I tried with the following commend, but its not working.
$sudo find /media/<Pendrive> *.jpg | rm -rf *
could someone let me know the exact command to delete the files from my Pendrive.
You can write:
If the text file is named
all_file_paths.txt, then you can write:(where the command
IFS= read -r file_to_deletereads one line from standard input — which in this case is coming fromall_file_paths.txt— and stores that line in the variable$file_to_delete).Note that this approach will misbehave if any file-paths contain the newline character. There’s no reliable way around that, since you’ve already discarded the distinction between “end of file-path” and “newline inside file-path” when you created
all_file_paths.txt.