I want to rename all .txt
files inside a folder. This rename do rename all .txt
for me:
rename 's/\.txt//g' *.txt -v
but when I want to rename all sub folders with
find ./ -type d -execdir rename 's/\.txt//g' *.txt -v ";"
It shows me:
Can't rename *.txt *: No such file or directory
Can't rename *.txt *: No such file or directory
...
Also find ./ -type -d
shows me current and all sub folders correctly.
Why I have No such file or directory
message?
You need to use
find
's-exec
syntax correctly, using'{}'
to represent the found filesRemove
-n
afterrename
once you've tested it.(assuming you really did want to change directory names and not regular file names - if that was the case, use
-type f
instead oftype -d
)