Skip to content

Magenaut

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

filenames

Extracting extension from filename in Python

August 21, 2022 by Magenaut

Is there a function to extract the extension from a filename?

Categories Python, Q&A Tags file-extension, filenames, python Leave a comment

Turn a string into a valid filename?

August 19, 2022 by Magenaut

I have a string that I want to use as a filename, so I want to remove all characters that wouldn’t be allowed in filenames, using Python.

Categories Python, Q&A Tags filenames, python, sanitize, slug Leave a comment

How do you import a file in python with spaces in the name?

August 17, 2022 by Magenaut

Do I have to take out all the spaces in the file name to import it, or is there some way of telling import that there are spaces?

Categories Python, Q&A Tags filenames, import, python, spaces Leave a comment

How can I replace (or strip) an extension from a filename in Python?

August 15, 2022 by Magenaut

Is there a built-in function in Python that would replace (or remove, whatever) the extension of a filename (if it has one)?

Categories Python, Q&A Tags filenames, python, scons, strip Leave a comment

Best way to remove file extension from a string?

August 11, 2022 by Magenaut

So, I’m using a script I’ve made to convert videos to the webm format. A certain program calls the script, sending %f which is the full, absolute file name of the video, like this:

Categories Q&A, Unix & Linux Tags filenames, shell Leave a comment

What are ./ and ../ directories?

August 11, 2022 by Magenaut

Simple question, but I’m not sure where to look and google doesn’t respond to periods and slashes.

Categories Q&A, Unix & Linux Tags directory, filenames Leave a comment

Converting relative path to absolute path without symbolic link

August 11, 2022 by Magenaut

Is there a Unix command to get the absolute (and canonicalized) path from a relative path which may contain symbolic links?

Categories Q&A, Unix & Linux Tags directory, filenames, shell, symlink Leave a comment

What does dash “-” at the end of a command mean?

August 11, 2022 by Magenaut

Given the following command:

Categories Q&A, Unix & Linux Tags filenames, shell Leave a comment

Redirect a file descriptor before execution

August 11, 2022 by Magenaut

I know that I can change the file a program writes to by interrupting the process in gdb, closing using the file descriptor and then re-opening with the file name I want. Is there a way to do the same thing at run time?

Categories Q&A, Unix & Linux Tags file-descriptors, filenames, files, process Leave a comment

Stripping directory paths to get file names

August 11, 2022 by Magenaut

What I am doing is converting mp3’s with LAME. I already have an old script I wrote that works but I want to add to it this ability–to no longer delete the file but instead save it in a new root folder with sub-directories that match the using the path that it is already in.

Categories Q&A, Unix & Linux Tags file-descriptors, filenames, shell-script, strip Leave a comment
Older posts
Page1 Page2 … Page6 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