LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Closed Thread
  Search this Thread
Old 09-12-2022, 02:26 PM   #1
ericlindellnyc
Member
 
Registered: Jun 2017
Posts: 181

Rep: Reputation: Disabled
Find Length in Characters for "Path + Filename" in Nested Directory


I have a deeply nested directory structure.

I would like it to be legal on popular file systems (linux, mac, and windows).

So I would like to limit the total length of "Pathname + Filename" for each file -- to some appropriate maximum (say, a thousand).

So first I need to determine all files whose pathname plus filename exceeds this limit -- and by how much.

I'll need to do other things later, like shorten it -- possibly by moving deep nodes higher up.

I have checked many bash and python approaches. They tell me variously . .
Code:
how to disable path limit in python
how many characters are in the file itself, as opposed to in its name
how to determine the length of a single filename -- but not using directory traversal
But none of them give the above-noted information.
Any suggestions much appreciated !!
 
Old 09-12-2022, 09:56 PM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,005

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
Usual story is, provide an example of the input and desired output followed by what you have attempted

I can tell you, assuming I understand what you have written so far, that this is a trivial problem that can be solved with a little searching

EDIT: Or you could of course keep following your already created thread:

https://www.linuxquestions.org/quest...re-4175608661/

Please do not create multiple threads for the same issue

Last edited by grail; 09-12-2022 at 09:58 PM.
 
1 members found this post helpful.
Old 09-13-2022, 09:42 AM   #3
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
Please post your thread only once. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.
 
  


Closed Thread

Tags
folders, length, python



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Is this possible? Create a tar.gz of a directory and place it in a different directory without all of the directories nested in the path? wh33t Linux - Software 4 10-30-2021 10:03 AM
find max length of characters in a perticular field suneelbabu.etl Programming 13 03-09-2014 12:23 PM
[SOLVED] Convert length-indicated variable length record file to LF-terminated Z038 Linux - General 10 11-29-2012 11:59 PM
[SOLVED] "tail -n 1 filename" error while "head -n 1 filename" is ok? type8code0 Linux - Newbie 3 03-21-2011 06:10 AM
Please help fix: sky2 error: rx length error: status 0x42c0500 length 600 trapix22 Linux - Wireless Networking 1 10-25-2008 07:50 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration