Topic "compare w./ subdirs"

Author Message
jottha

Guest


As my search shows, an often requested feature.

I do not understand enough about the windows command line and the way WinSCP passes parameters to it to try this for myself, but wouldn't going to preferences->commands and changing the command for compare directories to something based on the following:

Quote:
FOR /R

Loop through files (Recurse subfolders)

Syntax
FOR /R [[drive:]path] %%parameter IN (set) DO command

Key
drive:path : The folder tree where the files are located.

set : A set of one or more files. Wildcards must be used.
If (set) is a period character (.) then FOR will
loop through every folder.

command : The command(s) to carry out, including any
command-line parameters.

%%parameter : A replaceable parameter:
in a batch file use %%G (on the command line %G)

This command walks down the folder tree starting at [drive:]path, and executes the DO statement against each matching file.

If the [drive:]path are not specified they will default to the current drive:path.

Unlike some other variants of the FOR command you must include a wildcard (either * or ?) in the 'set' to get consistent results returned. In many cases you can work around this by adding a single character wildcard e.g. if you are looping through multiple folders to find the exact filename myfile.txt you could instead specify myfile.t?t

Examples:

Delete every .bak file in every subfolder starting at C:\temp

C:\>FOR /R C:\temp\ %%G IN (*.bak) DO del %%G

List all the subfolders under C:\Work

FOR /R "C:\Work\" %%G in (.) DO (
Pushd %%G
Echo now in %%G
Popd )
Echo "back home"t


(source: http://ss64.com/nt/for_r.html )

be a promising approach, with the appropriate fc or comp command in the DO part ?

Please somebody with the expertise have a look into this
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Can you please explain what you actually want to achieve?
Have you considered using Synchronization (checklist)?
http://winscp.net/eng/docs/task_synchronize_full
http://winscp.net/eng/docs/ui_synchronize_checklist
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License