How can I remove the first letter from a directory name? for example: Folder is named as "AFolder_01" how can I rename it to "Folder_01"
The reason for my question is that I have list of folders and I want to rename all these folders at once by removing the first letter. I found this code online to remove the last character(s):
while IFS= read -r dir; do [[ -d $dir ]] && mv -i "$dir" "${dir%?}"; done <all.txt
- How can this code be revised to remove the first letter? i.e. In my example rename "AFolder_01" to "Folder_01"
- How can this code be revised to add charterer back at the beginning of the folder name: i.e. in my example rename "Folder_01" to "AFolder_01"