Renaming Files
To rename all files in a directory and add a new extension the xargs command can be used:
ls | xargs -t -i mv {} {}.renamed
xargs reads each item from the ls ouput and executes the mv command. The ‘-i’ option tells xargs to replace ‘{}’ with the name of each item. The ‘-t’ option instructs xargs to print the command before executing it.
Leave a Reply
You must be logged in to post a comment.