Skip to content

Magenaut

  • Home
  • Topics
    • Notes
    • Tutorial
    • Bug fixing
    • Extension
    • Server
  • Q&A
  • Privacy Policy
  • About

directory

Iterating through directories with Python

August 19, 2022 by Magenaut

I need to iterate through the subdirectories of a given directory and search for files. If I get a file I have to open it and change the content and replace it with my own lines.

Categories Python, Q&A Tags directory, python Leave a comment

How to import a Python class that is in a directory above?

August 19, 2022 by Magenaut

I want to inherit from a class in a file that lies in a directory above the current one.

Categories Python, Q&A Tags directory, module, python, python-import Leave a comment

How to find the real user home directory using python?

August 18, 2022 by Magenaut

I see that if we change the HOME (linux) or USERPROFILE (windows) environmental variable and run a python script, it returns the new value as the user home when I try

Categories Python, Q&A Tags directory, home-directory, linux, python, windows Leave a comment

How do I check if directory exists in Python?

August 17, 2022 by Magenaut

How do I check if a directory exists?

Categories Python, Q&A Tags directory, python Leave a comment

Reading the target of a .lnk file in Python?

August 14, 2022 by Magenaut

I’m trying to read the target file/directory of a shortcut (.lnk) file from Python. Is there a headache-free way to do it? The spec is way over my head.
I don’t mind using Windows-only APIs.

Categories Python, Q&A Tags directory, lnk, python, shortcut, target Leave a comment

Get folder name of the file in Python

August 13, 2022 by Magenaut

In Python what command should I use to get the name of the folder which contains the file I’m working with?

Categories Python, Q&A Tags directory, python, python-3.x Leave a comment

Renaming multiple files in a directory using Python

August 13, 2022 by Magenaut

I’m trying to rename multiple files in a directory using this Python script:

Categories Python, Q&A Tags directory, python, rename Leave a comment

How to select a directory and store the location using tkinter in Python

August 11, 2022 by Magenaut

I am creating a GUI with a browse button which I only want to return the path. I’ve been looking at solutions using code like below.

Categories Python, Q&A Tags button, directory, python, python-2.x, tkinter Leave a comment

Import from sibling directory

August 11, 2022 by Magenaut

I have a Python class called “ClassA” and another Python class which is supposed to import ClassA which is “ClassB”. The directory structure is as follows:

Categories Python, Q&A Tags directory, parent, path, python, sys Leave a comment

How can I make ls show information about the directory specified only, not info about its sub-files or folder contents?

August 11, 2022 by Magenaut

Say I have folder “foo” residing, the home directory. I want to get some info of it, owner, group, permissions, etc…

Categories Q&A, Unix & Linux Tags directory, ls Leave a comment
Older posts
Newer posts
← Previous Page1 Page2 Page3 Page4 … Page11 Next →
  1. michealSmith07 on Is there a way to dynamically refresh the less command?August 21, 2022

    That is a very nice post. I like this post.

  2. anonymous on Fix libwacom9 dependency issue when upgrade DebianJune 27, 2022

    saved my day!! Thanks for the help…

  3. sreedhar on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    Thanks its working

  4. saintnick on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    remove libwacom2 worked for me as well

  5. ranafoul on Fix libwacom9 dependency issue when upgrade DebianApril 22, 2022

    apt remove libwacom2 helped on kali 2022.01. gr8

.net ajax asp.net asp.net-core asp.net-mvc asp.net-mvc-3 asp.net-mvc-4 asp.net-web-api bash c# command-line css custom-post-types custom-taxonomy dataframe dictionary django entity-framework functions gridview html iis javascript jquery json linux list matplotlib numpy pandas php plugin-development plugins posts python python-2.7 python-3.x security shell shell-script sql string vb.net webforms wp-query

© 2026 Magenaut • Built with GeneratePress