Given that you contrast your failing sed
command with rename
, it looks like you're trying to rename files, whereas the sed
command would perform a string substitution in the content of the files you pass; the -i
option then writes the modified input back to the input file (loosely speaking).
sed
cannot rename files directly, but you can use it as an auxiliary command to construct a new filename you then pass to mv
:
find "$HOME/Desktop" -name "*.dpx" -print0 |
while IFS= read -d '' -r file; do
echo mv "$file"' "$(sed 's/Exile1/ExileR1/' <<<"$file")"
done
Remove echo
to perform actual renaming.