I have >2000 files which are named like
123-FILENAME_TEXT_M101K_20150929.CSV
where 123
can be any three or four-digit number. The files are all within the same directory. I would like a script that removes the prefixing number and the dash. (i.e. the leading 123-
should be removed from the example name)
I have tried mv **-FILENAME* FILENAME*
. rename
is not an available function
You could try something like this, it will remove everything before the first -
for file in *-*.CSV
do
newName="${file#*-}"
mv -- "${file}" "${newName}"
done
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments