Skip to content

Instantly share code, notes, and snippets.

@ChamodDamitha
Last active December 29, 2017 11:22
Show Gist options
  • Save ChamodDamitha/099e8c27d65b48e478e9dfc28b0bccdb to your computer and use it in GitHub Desktop.
Save ChamodDamitha/099e8c27d65b48e478e9dfc28b0bccdb to your computer and use it in GitHub Desktop.

Revisions

  1. Chamod Damitha Samarajeewa revised this gist Dec 29, 2017. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion file_order.py
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,6 @@

    files = [f for f in os.listdir('.') if os.path.isfile(f)]
    for f in files:
    # do something
    ext = f.split('.')[-1]
    dirr = 'Chategorized/' + ext + "-files"
    if ext not in types:
  2. Chamod Damitha Samarajeewa created this gist Dec 29, 2017.
    15 changes: 15 additions & 0 deletions file_order.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    import os
    from shutil import copyfile

    types = []

    files = [f for f in os.listdir('.') if os.path.isfile(f)]
    for f in files:
    # do something
    ext = f.split('.')[-1]
    dirr = 'Chategorized/' + ext + "-files"
    if ext not in types:
    if not os.path.exists(dirr):
    os.makedirs(dirr)
    copyfile(f, dirr + '/' + f)