Skip to content

Instantly share code, notes, and snippets.

@pararang
Last active June 1, 2020 00:48
Show Gist options
  • Save pararang/4dbea2f8c729928fdb3c8352d320b9ec to your computer and use it in GitHub Desktop.
Save pararang/4dbea2f8c729928fdb3c8352d320b9ec to your computer and use it in GitHub Desktop.

Revisions

  1. pararang revised this gist Jun 1, 2020. 1 changed file with 8 additions and 8 deletions.
    16 changes: 8 additions & 8 deletions script-listing-image-files.py
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,14 @@
    import os
    mylist = ""
    dirList = os.listdir()
    with open("selectedforalbum.txt", "w", encoding="utf-8") as file:
    for dir in dirList:
    my_list = ""
    directory_list = os.listdir()
    with open("selected-images.txt", "w", encoding="utf-8") as file:
    for dir in directory_list:
    if os.path.isdir(dir) == False:
    continue
    mylist += '------ START OF ' + dir + " ------\n"
    my_list += '------ START OF ' + dir + " ------\n"
    for eachfile in os.listdir(dir):
    if eachfile.lower().endswith(('.png', '.jpg', '.jpeg')) == False:
    continue
    mylist += eachfile + "\n"
    mylist += '------ END OF ' + dir + " ------\n\n"
    file.write(mylist)
    my_list += eachfile + "\n"
    my_list += '------ END OF ' + dir + " ------\n\n"
    file.write(my_list)
  2. pararang created this gist Jun 1, 2020.
    14 changes: 14 additions & 0 deletions script-listing-image-files.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    import os
    mylist = ""
    dirList = os.listdir()
    with open("selectedforalbum.txt", "w", encoding="utf-8") as file:
    for dir in dirList:
    if os.path.isdir(dir) == False:
    continue
    mylist += '------ START OF ' + dir + " ------\n"
    for eachfile in os.listdir(dir):
    if eachfile.lower().endswith(('.png', '.jpg', '.jpeg')) == False:
    continue
    mylist += eachfile + "\n"
    mylist += '------ END OF ' + dir + " ------\n\n"
    file.write(mylist)