Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: compare two folders and copy folder/file if not found on target else log that file or folder

by ww (Bishop)
on Feb 20, 2014 at 15:13 UTC ( #1075592=note: print w/ replies, xml ) Need Help??


in reply to compare two folders and copy folder/file if not found on target else log that file or folder

"...if that folder/file is not found then copy that ..."

Uh, copying an undef or nul seems fairly pointless. Do you mean 'copy what was found in one into the other?'; 'create a log entry documenting what was NOT found in one that was in the other?' or something else?

Come, let us reason together: Spirit of the Monastery


Comment on Re: compare two folders and copy folder/file if not found on target else log that file or folder
Re^2: compare two folders and copy folder/file if not found on target else log that file or folder
by shan_emails (Beadle) on Feb 20, 2014 at 15:24 UTC

    Basically i am comparing two folder (source folder and target folder).

    In the target folder the source folder files/subfolders are not found then copy them. Else if it is found then don't copy that file instead log them stating that respective file already exists.

      OK, that's what I suspected and others discerned to be your meaning. Now let me give you a 'simple english' version that's wordy but utterly unambiguous:
      "I'm comparing two folders. If a file or subfolder is NOT found in the second but is present in the first, copy the missing item from the first to the second; otherwise... simply log that a file or dir was found in BOTH folders."

      Note that this expression does NOT concern itself with items found in the second folder, but not the first. That's a different requirement and requires a different problem statement.

      As with programming, communicating anything even mildly complex depends heavily on clarity and precision.

      Come, let us reason together: Spirit of the Monastery

      Quis custodiet ipsos custodes. Juvenal, Satires

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1075592]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2015-07-07 00:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (86 votes), past polls