using remove to look at all subfolders and files in a batch to get total namelength under a specific number

Advanced Renamer forum
#1 : 18/06-20 19:36
Jeff Alford
Jeff Alford
Posts: 1
example: cleaning up a fileserver prior to a Dropbox migration

I understand how to cut the filenames down using this code:
To truncate a filename you can use the Remove method and configure it like this:
Remove count: 100000
Starting at: 75
Apply to: Name

How do I scan a folder and all subs and then cut the names down to say 200 character pathname?
In this scenario there are a bunch of nested folders to get to the 200 and not necessarily the filename at the end. Tough because sometimes the folder is descriptive for the file, but for the sake of this argument. I want to pull in all folders and subs and limit the nested folder limit to say 15 characters all along the path.

Cleaning the long filenames prior will get a lot under the 200 limit, but not all.
Appreciate any and all help. Want to test that this software will do what is needed and will then buy the proper license.

Thanks in advance!
Jeff




18/06-20 19:36
#2 : 20/06-20 10:47
David Lee
David Lee
Posts: 1125
I don't believe that ARen is able to rewrite a new path. One solution would be to convert the path to DOS 8.3 format. That will reduce the names of each level of the folder structure to a total of 8 characters - retaining the original first 6 characters of each level. An advantage of this method is that it is using existing unique short filenames so there isn't any risk of duplication of names.

eg "C:\Users\David\Desktop\New folder\a long folder name\2nd long folder\New Text Document.txt" -> C:\Users\David\Desktop\NEWFOL~1\ALONGF~1\2NDLON~1\NEWTEX~1.TXT

You can do this easily using a Windows batch script. See the suggestion at https://superuser.com/questions/348079/how-can-i -find-the-short-path-of-a-windows-direct ory-file

EDIT: The above will give you the short filename versions of your filenames but I don't know whether it is possible to rename the original paths to the shorten form - so this may not be of much help.


20/06-20 10:47 - edited 20/06-20 12:50