1

I am encountering an issue with Sourcetree's custom actions when dealing with multiple files that have spaces in their filenames. When using $FILE as the parameter for custom actions, Sourcetree sends all the filenames with their paths, space-separated. This works fine for files without spaces in their filenames. However, for files with spaces in their filenames, the batch script cannot distinguish if the space is part of the filename or separates two filenames.

If I use "$FILE", Sourcetree only sends one filename enclosed in double quotes, for example, "file name".

Could anyone advise on how to correctly handle and process all the filenames from Sourcetree, ensuring that filenames with spaces are properly recognized as a single file?

Thank you!

What I Tried I attempted to use $FILE and "$FILE" as parameters for the custom actions. With $FILE, filenames are space-separated, causing issues with filenames that contain spaces. Using "$FILE" only processes one filename at a time, not all the selected files.

What I Expected to Happen I expected to find a way for Sourcetree to correctly pass multiple filenames, including those with spaces, to the custom action so that the batch script can process them accurately.

1
  • Please provide enough code so others can better understand or reproduce the problem. Commented Jul 7, 2024 at 13:35

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.