ListTemporaryFiles list all files in TEMP / TMP / %SystemRoot%\Temp
(verbose bool)
| 88 | |
| 89 | // ListTemporaryFiles list all files in TEMP / TMP / %SystemRoot%\Temp |
| 90 | func ListTemporaryFiles(verbose bool) (files []string) { |
| 91 | |
| 92 | var folders = []string{os.Getenv("TEMP")} |
| 93 | if os.Getenv("TMP") != os.Getenv("TEMP") { |
| 94 | folders = append(folders, os.Getenv("TMP")) |
| 95 | } |
| 96 | |
| 97 | if os.Getenv("SystemRoot")+`\Temp` != os.Getenv("TEMP") { |
| 98 | folders = append(folders, os.Getenv("SystemRoot")+`\Temp`) |
| 99 | } |
| 100 | |
| 101 | for _, p := range folders { |
| 102 | f, err := RetrivesFilesFromUserPath(p, true, defaultScannedFileExtensions, true, verbose) |
| 103 | if err != nil { |
| 104 | if verbose { |
| 105 | logMessage(LOG_INFO, err) |
| 106 | } |
| 107 | continue |
| 108 | } |
| 109 | |
| 110 | for _, i := range f { |
| 111 | files = append(files, i) |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | return files |
| 116 | } |
| 117 | |
| 118 | // FormatPathFromComplexString search for file/directory path and remove environments variables, quotes and extra parameters |
| 119 | func FormatPathFromComplexString(command string) (paths []string) { |
no test coverage detected