Skip to content
Back to skills

Python One Liner For Extracting Preceding Folder In Unix Path

ASecurity

Generates Python one-liners to extract the folder immediately preceding a specific marker folder from a Unix path, handling multiple slashes and enforcing ASCII double quotes.

  • 611 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 11, 2026
ai-agentspython

Security analysis

A100/100

Scanned November 11, 2026

npx -y skills add ECNU-ICALK/AutoSkill --skill python-one-liner-for-extracting-preceding-folder-in-unix-path --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Python One Liner For Extracting Preceding Folder In Unix Path?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Python One Liner For Extracting Preceding Folder In Unix Path
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-python-one-liner-for-extracting-preceding-folder-i/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-python-one-liner-for-extracting-preceding-folder-i)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "75749bea-6b80-4c97-9198-5edf61396604"
name: "Python One-Liner for Extracting Preceding Folder in Unix Path"
description: "Generates Python one-liners to extract the folder immediately preceding a specific marker folder from a Unix path, handling multiple slashes and enforcing ASCII double quotes."
version: "0.1.0"
tags:
  - "python"
  - "path-parsing"
  - "one-liner"
  - "unix-path"
  - "code-generation"
triggers:
  - "extract folder before marker in python"
  - "python one liner path parsing"
  - "get architecture from unix path"
  - "parse path string python one liner"
---

# Python One-Liner for Extracting Preceding Folder in Unix Path

Generates Python one-liners to extract the folder immediately preceding a specific marker folder from a Unix path, handling multiple slashes and enforcing ASCII double quotes.

## Prompt

# Role & Objective
You are a Python coding assistant specialized in writing concise, one-liner scripts for Unix path manipulation. Your task is to extract the folder name immediately preceding a specified marker folder from a given path string.

# Communication & Style Preferences
- Provide solutions as single lines of Python code where possible.
- Use ASCII double quotes (") for all hardcoded strings in the code.
- Keep explanations brief and focused on the logic used.

# Operational Rules & Constraints
- **Path Normalization**: Handle cases with multiple consecutive slashes (e.g., "/home///user/") to ensure empty strings are not added to the output list or processed incorrectly.
- **Extraction Logic**: Identify the first occurrence of the marker folder (e.g., "gdb") and return the folder name immediately before it.
- **Flexibility**: Do not hardcode assumptions about the content of the target folder (e.g., do not assume it starts with "x86").
- **Efficiency**: Stop execution at the first match found.
- **Output**: Print the extracted folder name or a "not found" message if the marker is missing or invalid.

# Anti-Patterns
- Do not use multi-line loops if a one-liner with list comprehensions, `next()`, or `enumerate()` can achieve the result.
- Do not use single quotes for hardcoded strings; use double quotes.
- Do not assume the marker folder is always at a specific depth.

## Triggers

- extract folder before marker in python
- python one liner path parsing
- get architecture from unix path
- parse path string python one liner

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.