Welcome to the Mythicsoft Q&A site for:

- Agent Ransack
- FileLocator Lite
- FileLocator Pro

Please feel free to ask any questions on these products or even answer other community member questions.

Useful Links:

- Contact Us
- Help Manuals
- Mythicsoft Home
+1 vote

Hi...I am trying to automate the process where I run a search and copy the files to a network folder. What is the command to copy found files from FlleLocator Network edition?

Found the answer --

$folder_list        = Get-Content -Path '.\results.txt'
$destination_folder = '.\found\'

foreach ($folder in $folder_list) {
    Get-ChildItem -Path $folder | Copy-Item -Destination $destination_folder -Recurse -ErrorAction SilentlyContinue
else {
    Write-Warning "Folder '$folder' not found.."

Note - You will get a lot of 'can't find the file....' errors but if you look in your 'found' directory, you'll see that the files did copied over (keeping folder heirarchy).

by (25 points)

1 Answer

0 votes

Actually...because the output file adds filesize, date, time to the path line, you need to parse the file and path from the text file...

$paths = Get-Content '(path\to\results.txt)'
$dest = '(path\to\FileDestination}'

for ($i = 1; $i -lt $paths.Length; $i += 3) {
$pathSplit = $paths[$i].Split('.')
$extension = $pathSplit[1].split(' ')[0]
$path = "$($pathSplit[0]).$extension"

Copy-Item -Path $path -Destination $dest -ErrorAction SilentlyContinue
by (45 points)