Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Python Renamer

Super flexible renamer app using python language · By Lion In A Box Games

Overview of all available commands and attributes Sticky

A topic by Lion In A Box Games created May 22, 2024 Views: 65
Viewing posts 1 to 1

This is an overview of all the commands and attributes that are directly available to you to easily modify all files!

Available Variables:

  • Files: List of all files in the selected directory
  • Folders: List of all folders in the selected  directory
  • CopiedFiles: List of all files you copied to a different directory while running this app

Available file attributes:

  • file.Directory: returns the path to the folder in which the file is placed (in string format)
  • file.Name: returns name of the file (without the extension)
  • file.NameExt: returns name of the file (with extension)
  • file.Path: returns full path of the file in string format
  • file.Extension: returns extension of the file (e.g. "png", "exe" or "txt"...)
  • file.FolderName: returns name of the folder in which the file is placed (in string format)
  • file.Folder: returns folder in which the file is placed (returns folder object, you can rename it and modify it)

Available folder attributes:

  • folder.Directory:  returns parent directory path of the folder in string format 
  • folder.Name: returns name of the folder
  • folder.Path: returns full path of the folder in string format
  • folder.Files: returns list of all the files in the folder. Returns object of the files which can be renamed and modified.

Available file and folder commands:

  • f.Rename(new_name): rename file/folder
  • f.Move(new_path): move a file/folder
  • f.CopyTo(new_path): copy a file/folder (returns file object so you can further modify the copied file, e.g.: "file_copy = file.CopyTo(new_path)")

Available file commands:

  • file.ChangeExtension(new_extension): change extension of a file

Available general commands:

  • CreateDirectory(new_path): Create a new folder directory
  • LoadDirectory(title="LoadDirectory"): browse window to get a directory as a string path. Attribute "title" will be displayed in the browse window.
  • CombinePaths(path1, path2): Create a new path in string format by combining 2
  • Enumerate(description=None, first_number=0, digits=2,start=" ",end="",last_number=float("inf")): auto-enumerate and increase number by 1 each time the function is run. Attributes: each Enumerate with a different "description" if provided enumerates seperately. "first_number": number with which to start counting. "digits": with how many digits to display the number (e.g. if set to 3: 000, 001, 002,...). "start": string text to include before the number. By default a simple space "  ". "end": string text to include after the number. By default empty. "last_number": after the last_number is reached, it stops returning a number, returns an empty string instead.
  • MainDirectory: string path of the selected main directory