Page 1 of 1
Sync Dirs: export left/right list to file
Posted: 2015-10-02, 09:37 UTC
by wanderer
It would be useful if Sync Dirs function supported exporting the left / right list of currently visible files (after applying the filters in the top of the window) to a text file, in the form "Folder\Filename", one per line.
If done, it would also be nice to have an option to append the parent path before "Folder\Filename" in each line, so that a list with full path of every file can be created.
Posted: 2015-10-02, 11:05 UTC
by MVV
I think you can currently parse tab-separated text that is copied by TC on Ctrl+C.
Posted: 2015-10-02, 11:11 UTC
by wanderer
Thanks for the info, didn't know that. Unfortunately it's not very convenient if you want to work with one of the two filelists though. You have to separate the left or right filenames plus you have to add the path in front of them...
Posted: 2015-10-02, 12:44 UTC
by MVV
That's why I've mentioned
parsing.
E.g. with PowerShell (tcGetSyncList.ps1 and tcGetSyncList.bat):
Code: Select all
param($syncListFile, $isRightSide);
Add-Type -AssemblyName System.Windows.Forms;
function getFileList($syncLines, $isRight) {
$subpath = '\';
$columns = 0, 8;
foreach ($line in $syncLines) {
$items = $line.Split("`t");
if ($items.Length -eq 1) {
$subpath = "\$line";
}
else {
$name = $items[$columns[$isRight -ne $false]];
if ($name) {
$subpath + $name;
}
}
}
}
if ($syncListFile -eq 'clip:') {
$syncLines = [Windows.Forms.Clipboard]::GetText().Split([char[]]"`r`n", [StringSplitOptions]::RemoveEmptyEntries);
}
else {
$syncLines = [IO.File]::ReadLines($syncListFile);
}
$isRightSide = [bool](iex $isRightSide);
getFileList $syncLines $isRightSide;
Code: Select all
@powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%~dpn0.ps1" %*
Usage:
Code: Select all
tcGetSyncList.bat 1.txt 0
tcGetSyncList.bat clip: 1
However copied data doesn't contain information about root left or right path.