|Hello, does anyone know how to write a batch file that will shorten a file name if it is longer than 40 characters? I don't care if it truncates the file name at the end and I don't want to remove whitespace before the file extension.|
I.E if the 36th character before the file extension is whitespace i want to leave it.
Original file name "A Files with whitespace before file extension.txt"
Rename to "A Files with whitespace before file .txt"
I need to be able rename all of the files that are all located in the same folder and all the files are text files. The batch file will not be in the same folder as the text files.
I.E. it would follow this structure:
The batch file will be in a folder. Inside this folder I will have say folderOne. Inside folderOne I will have folderTwo, Inside folderTwo I will have folderThree and inside folderThree will be all of the text files that need to be renamed.
Also not all the files in folderThree are longer than 40 characters. So if the file name is less than 40 characters long there shall be no change to the file name. Only files longer than 40 characters need to be renamed.
Any help on this would be greatly appreciated.