Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
|
Lista Forumurilor Pe Tematici
|
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login
POZE MRRRR'S FORUM (VIEW ONLY)
Nu sunteti logat.
|
Nou pe simpatie: ramonaa86
 | Femeie 25 ani Brasov cauta Barbat 31 - 46 ani |
|
Mrrrr
AdMiN
 Inregistrat: acum 19 ani
Postari: 2344
|
|
I have a bunch of books scanned in my PC and would like to check if I have any books from a given list of authors.
The following code will return the paths of the files if any. F:\AUTHORS.txt contains a list of authors like Name, Surname - 1 per line. F:\AUTHORS_RESULTS.txt will contain the results D:\SCANS is the folder with several subfolders that's gonna be searched.
This runs in Terminal:
$authors = Get-Content "F:\AUTHORS.txt" $output = "F:\AUTHORS_RESULTS.txt" $folder = "D:\SCANS"
# Clear output file first if (Test-Path $output) { Remove-Item $output }
foreach ($author in $authors) { Add-Content $output $author
$files = Get-ChildItem $folder -Recurse -File -ErrorAction SilentlyContinue | Where-Object { $_.Name -like "*$author*" }
foreach ($file in $files) { Add-Content $output $file.FullName } } |
_______________________________________

|
|
| pus acum 2 zile |
|