8/18/2023 0 Comments Batch change file extensionIf no matches are found the unexpanded version is passed.Īgain: the shell expands the patterns, not the program. The list of files are passed to the program, here mv. The shell, lets assume bash, expands the wildcards if there are any matching files (including directories). When you issue the command: mv *.txt *.tsv 1 root root 0 Jan 26 11:40 test4.gappedPeak 1 root root 0 Jan 26 11:40 test3.gappedPeak 1 root root 0 Jan 26 11:40 test2.gappedPeak 1 root root 0 Jan 26 11:40 test1.gappedPeak name "*.gappedPeak" -exec sh -c 'mv "$1" "$ is replaced by each ( *.gappedPeak) filename foundīy the find command, and becomes $1 to the sh command. This should work on any POSIX-compliant system: find. ![]() I know this doesn't answer your question, but in case you were looking for another way to rename the files compared to your work-around loop, why not use find? I have used this command many times to replace file extensions in large directories with hundreds of thousands of files in it.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |