ludwig
3 years ago
1 changed files with 43 additions and 0 deletions
@ -0,0 +1,43 @@ |
|||||
|
import os |
||||
|
|
||||
|
|
||||
|
def main(): |
||||
|
|
||||
|
exts = ('.jpg', '.webm', '.png', '.mp4', '.gif', '.pdf', '.odt') |
||||
|
|
||||
|
print("The Source directory is " + os.getcwd()) |
||||
|
newdir = str(input("Please enter a directory:")) |
||||
|
|
||||
|
if not os.path.isdir(newdir): # Checks if directory exists |
||||
|
print("Directory does not exist") |
||||
|
|
||||
|
|
||||
|
else: |
||||
|
directory = os.path.join(os.getcwd(), newdir) # If true, sets directory to new dir, and changes dir |
||||
|
os.chdir(directory) |
||||
|
print("Directory found " + os.getcwd()) |
||||
|
# file_list=glob.glob('*.png') #checks to see if files are in directory, asks user if they look familiar |
||||
|
frecognize(directory, exts) |
||||
|
|
||||
|
|
||||
|
def frecognize(directory, exts): |
||||
|
file=[] |
||||
|
#i = 0 |
||||
|
#while i < 3: |
||||
|
for file in os.listdir(directory): |
||||
|
|
||||
|
if file.endswith(exts): |
||||
|
print(file) |
||||
|
#i += 1 |
||||
|
|
||||
|
|
||||
|
def frename(directory): |
||||
|
str(oldname) |
||||
|
newname = str(input("Please enter the new filename: ")) |
||||
|
|
||||
|
for file in os.listdir(directory) |
||||
|
|
||||
|
main() |
||||
|
|
||||
|
# todo add gui |
||||
|
# todo make frecognize do what the fuck I want it to (print x amount of files) |
Loading…
Reference in new issue