About 156,000 results
Open links in new tab
  1. How to rename a file using Python - Stack Overflow

    If the file is open, for instance, shutil.move will create a file with new_name, but will not delete the file with old_name hence leaving you with two files. os.rename on the other hand will do …

  2. Rename and move file with Python - Stack Overflow

    The rename function allows you to change the name of the file and it's folder at the same time. To prevent any errors in renaming and moving of the file, use shutil.move.

  3. Renaming multiple files in a directory using Python

    os.listdir() returns just the filenames and not the full path of the file. Use os.path.join(path, file) to get the full path and rename that.

  4. python - Batch Renaming of Files in a Directory - Stack Overflow

    Is there an easy way to rename a group of files already contained in a directory, using Python? Example: I have a directory full of *.doc files and I want to rename them in a consistent way. X...

  5. Rename multiple files in a directory in Python - Stack Overflow

    May 3, 2010 · I'm trying to rename some files in a directory using Python. Say I have a file called CHEESE_CHEESE_TYPE.*** and want to remove CHEESE_ so my resulting filename would …

  6. How To Rename Files (Using Python OS Module)? - Stack Overflow

    Jun 18, 2022 · Unlike the command line program rename which can rename a batch of files using a pattern in a single command, Python's os.rename() is a thin wrapper around the underlying …

  7. rename - Changing file extension in Python - Stack Overflow

    May 24, 2010 · Suppose from index.py with CGI, I have post file foo.fasta to display file. I want to change foo.fasta's file extension to be foo.aln in display file. How can I do it?

  8. python - renaming the extracted file from zipfile - Stack Overflow

    May 20, 2017 · I need to add the parent zipped folder name to the end of file names and save all text files in one directory. For example, if the zipped folder was March132017.zip and I …

  9. python - Rename a file with a pattern - Stack Overflow

    Aug 8, 2015 · possible duplicate of Open file knowing only a part of its name -- this shows a lot of ways to get a file name when you only know part of it. You can use these answers to get to the …

  10. python - Force Overwrite in Os.Rename - Stack Overflow

    Nov 12, 2011 · Is it possible to force a rename os.rename to overwrite another file if it already exists? For example in the code below if the file Tests.csv already exists it would be replaced …