Skip to content

Commit

Permalink
New date formats for non standard dates returned by LIST (#354)
Browse files Browse the repository at this point in the history
  • Loading branch information
esperlu authored Jan 11, 2024
1 parent 824fdbc commit a93533d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ var listLineParsers = []parseFunc{
var dirTimeFormats = []string{
"01-02-06 03:04PM",
"2006-01-02 15:04",
"01-02-2006 03:04PM",
"01-02-2006 15:04",
}

// parseRFC3659ListLine parses the style of directory line defined in RFC 3659.
Expand Down
4 changes: 3 additions & 1 deletion parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ var listTests = []line{
// DOS DIR command output
{"08-07-15 07:50PM 718 Post_PRR_20150901_1166_265118_13049.dat", "Post_PRR_20150901_1166_265118_13049.dat", 718, EntryTypeFile, newTime(2015, time.August, 7, 19, 50)},
{"08-10-15 02:04PM <DIR> Billing", "Billing", 0, EntryTypeFolder, newTime(2015, time.August, 10, 14, 4)},

{"08-07-2015 07:50PM 718 Post_PRR_20150901_1166_265118_13049.dat", "Post_PRR_20150901_1166_265118_13049.dat", 718, EntryTypeFile, newTime(2015, time.August, 7, 19, 50)},
{"08-10-2015 02:04PM <DIR> Billing", "Billing", 0, EntryTypeFolder, newTime(2015, time.August, 10, 14, 4)},

// dir and file names that contain multiple spaces
{"drwxr-xr-x 3 110 1002 3 Dec 02 2009 spaces dir name", "spaces dir name", 0, EntryTypeFolder, newTime(2009, time.December, 2)},
{"-rwxr-xr-x 3 110 1002 1234567 Dec 02 2009 file name", "file name", 1234567, EntryTypeFile, newTime(2009, time.December, 2)},
Expand Down

0 comments on commit a93533d

Please sign in to comment.