Skip to content

Commit

Permalink
Fixes suggested by Yardanico @ Nim Discord
Browse files Browse the repository at this point in the history
  • Loading branch information
unquietwiki committed Nov 14, 2022
1 parent cd50ae6 commit 1f310d2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ _sortplz_ is a simple file sorter. It takes targeted files, and moves them to su
- 2022.10.04.2 -> Initial Release
- 2022.10.04.3 -> Added colored output & partially-successful "silent" flag.
- 2022.11.04.1 -> Added recursion; added name-string sorting; "silent" issues may be fixed?
- 2022.11.13.1 -> Fixes from Nim Discord community.

## TODO

Expand Down
2 changes: 1 addition & 1 deletion src/config.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const
pkgTitle* = "sortplz"
pkgVersion* = "2022.11.04.1"
pkgVersion* = "2022.11.13.1"
pkgAuthor* = "Michael Adams, [email protected]"
pkgDescription* = "Sort files into subdirectories, based on given criteria."
12 changes: 6 additions & 6 deletions src/sortplz.nim
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#[
sortplz: sort files into subdirectories, based on given criteria.
Michael Adams, unquietwiki.com, 2022-11-04
Michael Adams, unquietwiki.com, 2022-11-13
]#

# Libraries
import std/[os, parseopt, sequtils, strutils, terminal]
import std/[os, parseopt, strformat, strutils, terminal]

# Config import (it's just variables)
include config
Expand Down Expand Up @@ -59,10 +59,10 @@ proc processDirNameString(ns: string) =

# Process the list of files in the source directory
if not recurse:
for f in toSeq(os.walkFiles(os.joinPath(fromdir))):
for f in os.walkFiles(fromdir):
moveThisFile(f, newdir)
else:
for f in toSeq(os.walkDirRec(os.joinPath(fromdir))):
for f in os.walkDirRec(fromdir):
if f.contains(ns):
moveThisFile(f, newdir)

Expand All @@ -76,10 +76,10 @@ proc processDirExt(ext: string) =

# Process the list of files in the source directory
if not recurse:
for f in toSeq(os.walkFiles(os.joinPath(fromdir,"*." & ext))):
for f in os.walkFiles(fromdir / fmt"*.{ext}"):
moveThisFile(f, newdir)
else:
for f in toSeq(os.walkDirRec(os.joinPath(fromdir))):
for f in os.walkDirRec(fromdir):
if f.splitFile.ext == "." & ext:
moveThisFile(f, newdir)

Expand Down

0 comments on commit 1f310d2

Please sign in to comment.