I am a newbie Python beginner. Need help with a code to output all folders in my D drive of my Windows 10 machine which have files (sub-folders -> subfolders etc) which has length more than 250 characters.
I have subscribed for cloud backup of a very popular cloud backup provider which has 250 characters file path length limit. So, it automatically excludes all files which have length more than 250 chars. So, it would be very helpful if I get a few lines of code which outputs the below:
Output -> All the root folders in D drive which have files which have more than 250 char length so that I can shorten the length of those folders specifically. I have 5 TB data so it's obvious that it's not a manual task.
Thanks for understanding.
Since you are already on windows here's a small script I could come up with:
Create a batch file and put below code into it (script.bat):
Steps:
1) Run this batch file. 2) it will ask for maximum chars allowed, insert 256 in your case.
Result: output.txt will be generated in your working directory which contains list of file names which are greater than provided input charater.
You can modify your scripts further as per requirements. You can refer to: https://ss64.com/nt/for_d.html