Query on File Path Length Limitation in ZennoPoster

Pierre Paul Jacques

Активный пользователь
Регистрация
08.10.2023
Сообщения
123
Благодарностей
33
Баллы
28
Hello Zenno Community,

What is the maximum size of path Length ?

I am currently facing a challenge with my automation process in ZennoPoster and would greatly appreciate your insights.

My process involves automating the handling of image files, which includes renaming and moving them across different directories. However, I've stumbled upon an issue where long file paths seem to prevent ZennoPoster from accessing and manipulating the files.

Through a series of tests and checks, I've deduced that the problem lies with the length of the file names. Windows has a known limitation where file paths exceeding a certain number of characters (traditionally 260 characters) can cause issues unless specific policies are enabled to handle long paths.

To address this, I've tried to implement a workaround by shortening the file names before attempting any file operations.
This step appears necessary to avoid the "path too long" error and to enable the file movement feature within ZennoPoster to function correctly.

Before I proceed further, I would like to understand if there are any official guidelines or limitations regarding the maximum number of characters for file paths that ZennoPoster can handle. Is there a specific character limit that we should adhere to for smooth operation within ZennoPoster?

Any documentation or advice on best practices for dealing with long file paths in ZennoPoster would be immensely helpful.

Thank you for your time and assistance. Looking forward to your valuable feedback.

Cheers

PS : for the moment i use a this Code before moving my files

117517




C#:
// Retrieve the source file path from the variable
string sourceFilePath = project.Variables["I_Before_Renaming"].Value;

// Convert to UNC path if not already
if (!sourceFilePath.StartsWith(@"\\?\"))
{
    sourceFilePath = @"\\?\" + sourceFilePath;
}

if (!string.IsNullOrEmpty(sourceFilePath) && System.IO.File.Exists(sourceFilePath))
{
    // Get the directory path of the source file
    string directoryPath = System.IO.Path.GetDirectoryName(sourceFilePath);

    // Set the new file name with the UNC prefix and name "temp.jpg"
    string newFilePath = System.IO.Path.Combine(directoryPath, "temp.jpg");

    try
    {
        // Rename the file
        System.IO.File.Move(sourceFilePath, newFilePath);

        // Update the variable with the new path if needed
        project.Variables["I_Before_Renaming"].Value = newFilePath;

        // The file renaming succeeded
        project.SendInfoToLog("The file has been successfully renamed to 'temp.jpg'.");
    }
    catch (System.Exception ex)
    {
        // Handle any exceptions here and send log information for debugging
        project.SendErrorToLog("Error while renaming the file: " + ex.Message);
    }
}
else
{
    // The source file is not found or the path is empty
    project.SendInfoToLog("The source file is not found or the path is empty.");
}
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)