Copy from multiple folders into a single FTP folder

SyncBack freeware has been retired and replaced with SyncBackFree. These old posts are being kept for reference only. SyncBack V3 freeware is no longer supported or available for download.

Copy from multiple folders into a single FTP folder

Postby janmarks » Wed Apr 25, 2007 4:59 pm

Couldn't find an answer to the following question:

Got to copy - or better "consolidate" - source files from multiple directories:

C:\Users\Public\Product Images\437x656
C:\Users\Public\Product Images\344x516

into a single FTP directory \pictures-ftp. All files located in the source directories should be copied to this single directory and we shall NOT copy/maintain the same subfolder structure...

Who can help to set up the profile properly?

Thanks!
janmarks
Newbie
Newbie
 
Posts: 1
Joined: Wed Apr 25, 2007 4:47 pm

Postby mickyj » Thu Apr 26, 2007 12:24 pm

Hi, you'll need two profiles (one for each source). Put them into a group and run/schedule the group.
User avatar
mickyj
2BrightSparks Staff
2BrightSparks Staff
 
Posts: 8056
Joined: Mon Jan 05, 2004 6:51 pm
Location: In front of computer

Postby m3rc4ry » Fri Jan 04, 2008 3:51 pm

mickyj wrote:Hi, you'll need two profiles (one for each source). Put them into a group and run/schedule the group.


But how would one do this for say about 360 folders.....

I need to consolidate files found in dated folders for a whole year. The folders are dated 01-12 for the months with each month folder having say 01-31 for subfolders. Devices call into this system and drop a specific file in the right folder depending on what date the data is for.

I'm using SyncBackSE to transverse the folders to aggregate the files and want to put them on an FTP server in one singular destination point without any subfolders. What I'm getting are all the subfolders for the files. I do not wish to have any folder structure - just the files found.

Any other suggestions on how I can do this?

The file filter is like *.MMS.XML and each are uniquely serialized.

Thank you for your help! :)
Merc.
m3rc4ry
Newbie
Newbie
 
Posts: 5
Joined: Fri Jan 04, 2008 3:43 pm

Postby Dave Wilkins » Fri Jan 04, 2008 5:56 pm

It's called folder-flattening, and you can't do it in SB freeware (or SBSE). This is a policy decision by 2BS due to the risk of file overwrites (ie, for files of the same name in different folders, last copy wins. Imagine the screams of innocent new users...)

You can mock it up as mickyj described with multiple profiles, but as you say that's not realistic for hundreds of folders.

Assuming all the folders are in one tree, and you have space to temporarily copy them to a holding area, you can work around it using a VB script to flatten the files into the holding area, then use SBSE to transfer them to FTP. The following script will do it

Code: Select all

' Script designed to scan a tree of folders searching for files as defined by ExprComp function
' and to "pour" the matching candidates into a 'flat' destination (no tree created)
' will overwrite files without warning, including those of same name in diff folders of Source
' last file copied wins!

' written/adapted by Dave Wilkins Jan 2008


SourcePath = "D:\Source Files" ' DO NOT INCLUDE TRAILING BACKSLASH

DestPath = "D:\Flattened Files\" ' *DO* INCLUDE TRAILING BACKSLASH

Set fso = CreateObject("scripting.filesystemobject")

Set folders = fso.GetFolder(SourcePath)

Recurse folders

'= = = = = = = = = START OF  SUBS & FUNCTIONS = = = = = = = = = =

Sub Recurse(ByRef folders)
 
  Set subfolders = folders.Subfolders
  Set sourcefiles = folders.Files

  For Each file In sourcefiles ' traverse each (sub)folder

   If ExprComp(file.Name) Then
      On Error Resume Next
      file.Copy DestPath
   End If
   
  Next 

  For Each folder In subfolders
    recurse folder
  Next 

  Set subfolders = Nothing
  Set sourcefiles = Nothing

End Sub


Function ExprComp (CompStr)

' designed to check for filename Like *.MMS.XML

CompStr = UCase(CompStr) ' trap lower-case instances

If Right(CompStr, 8) = ".MMS.XML" Then
   ExprComp = True
Else
   ExprComp = False
End If

End Function

If there's anything about the filenames you haven't told me, feel free to amend the comparison function accordingly! Hope this is of some use

Rgds
DW
Dave Wilkins
2BrightSparks Staff
2BrightSparks Staff
 
Posts: 7776
Joined: Thu Jan 04, 2007 10:02 am

Postby m3rc4ry » Fri Jan 04, 2008 6:46 pm

dwilkins11c wrote:It's called folder-flattening, and you can't do it in SB freeware (or SBSE). This is a policy decision by 2BS due to the risk of file overwrites (ie, for files of the same name in different folders, last copy wins. Imagine the screams of innocent new users...)

You can mock it up as mickyj described with multiple profiles, but as you say that's not realistic for hundreds of folders.

Assuming all the folders are in one tree, and you have space to temporarily copy them to a holding area, you can work around it using a VB script to flatten the files into the holding area, then use SBSE to transfer them to FTP. The following script will do it



Thanks and understand the reasoning completely....

As you've proposed, writing a VB script was also my thoughts.....

It would be nice however if there was a "folder flattening" option though in the software and that you can choose to overwrite a duplicate or append say a number to a file if a duplicate is encountered.

However even without this option this application is awesome!
m3rc4ry
Newbie
Newbie
 
Posts: 5
Joined: Fri Jan 04, 2008 3:43 pm

Postby Dave Wilkins » Fri Jan 04, 2008 7:11 pm

If you think the freeware is good, you should check out the SE version!

Rgds
DW
Dave Wilkins
2BrightSparks Staff
2BrightSparks Staff
 
Posts: 7776
Joined: Thu Jan 04, 2007 10:02 am

Postby m3rc4ry » Wed Apr 02, 2008 12:25 am

Hi - I'm back.....

I've been running SBSE with much success but still wish to reiterate that there needs to be an option to allow folder flattening on the destination. We've found it too cumbersome to have to setup intermediate processes to flatten the folders before moving the files. We'd also like to just drop the files into an interface folder for processing. Any other suggestions that could help on how to get the program to flatten folders on its own would be appreciated. If an option was created I'd put a futher rule to either overwrite duplicates or append a user determined numerical suffix on the file sequentionally to keep files unique. Thanks!

Merc
m3rc4ry
Newbie
Newbie
 
Posts: 5
Joined: Fri Jan 04, 2008 3:43 pm

Postby bradavon » Wed Aug 27, 2008 11:16 pm

I agree with the other members there really needs to be an option to copy all files from several source folders into a single destination folder.

How about the option then a BIG prompt window, warning you each time it's enabled. That's seems like a suitable solution to the reasoning behind the restriction in my opinion.

My reasoning is here:

http://2brightsparks.com/bb/viewtopic.php?t=5301
User avatar
bradavon
Expert
Expert
 
Posts: 50
Joined: Sun Feb 10, 2008 4:25 am
Location: South West, England

A Small App to do just that

Postby SigSingh » Tue Sep 23, 2008 3:49 am

Here is a small application that will do exactly what you are looking for:

Consolidate Files from multiple directories. The only disadvantage is that it only works on the Mac...
SigSingh
Newbie
Newbie
 
Posts: 1
Joined: Tue Sep 23, 2008 3:44 am

Postby bradavon » Tue Sep 23, 2008 9:57 am

Thanks, one minor problem. I don't have a Mac :D.
User avatar
bradavon
Expert
Expert
 
Posts: 50
Joined: Sun Feb 10, 2008 4:25 am
Location: South West, England

Re: Copy from multiple folders into a single FTP folder

Postby MarkSt » Mon May 30, 2011 4:08 pm

Came across this, but I don't know how well it works yet... Just discovered it.

http://lifehacker.com/5296664/suction-c ... s-into-one
MarkSt
Newbie
Newbie
 
Posts: 5
Joined: Fri Sep 01, 2006 1:11 am


Return to SyncBack V3 (freeware)

Who is online

Users browsing this forum: Yahoo [Bot] and 8 guests

cron

User Control Panel

Login

Who is online

In total there are 9 users online :: 1 registered, 0 hidden and 8 guests (based on users active over the past 5 minutes)
Most users ever online was 725 on Thu Feb 20, 2014 2:37 pm

Users browsing this forum: Yahoo [Bot] and 8 guests