Folder Move

Started by CadJoe, November 04, 2014, 03:18:29 PM

Previous topic - Next topic

CadJoe

Seems that this moves the entire Source Folder to the Destination Folder.

Is there a way to tweak it to only move the content of Source, directly into Destination ?


sourcedir = E:\Reports
targetdir = F:\Reports
;
FOF_CREATEPROGRESSDLG = 0 ;Create Progress dialog
oShell = ObjectCreate("Shell.Application")
oFolder = oShell.NameSpace(targetdir)
oFolder.MoveHere( sourcedir, FOF_CREATEPROGRESSDLG )
oShell = 0
;



E:\Reports\Folder 1, 2, 3, etc

Results in moving the entire e:\Reports folder into F:\Reports.

ie, F:\Reports\Reports\Folder 1, 2, 3,

and then deleting E:\Reports

I don't want to remove e:\reports, just subfolders and files.
and move them directly into the Destination Folder Reports.

Also, I can't just change Destination to F:\  instead of F:\Reports, as it has different ACL's from Source that can't change.

Running on Server 2012 R2.

Thanks,

CadJoe
WinBatch, Gotta Love It!

CadJoe

Ok, all fixed.

Might not be the correct way, but works.

I used DirItemize to get the sub folders, and then put oFolderMove inside For Loop, changing the source each time with Dest static.

I also changed FOF to value 16 to suppress Prompts.



For FOLDER_LOOP = 1 To DIR_COUNT
   ;
   CURR_DIR=ItemExtract(FOLDER_LOOP, FOLDER_LIST, @TAB)
   ;
   WinTitle("", CURR_DIR)
   ;
   sourcedir = (strcat(SOURCE_PATH,"\",CURR_DIR))
   ;
   ;
   FOF_CREATEPROGRESSDLG = 16 ; Suppress Prompt
   oShell = ObjectCreate("Shell.Application")
   oFolder = oShell.NameSpace(targetdir)
   oFolder.MoveHere( sourcedir, FOF_CREATEPROGRESSDLG )
   oShell = 0
   ;
   ;
NEXT FOLDER_LOOP


Works great now.

Thanks,

CadJoe
WinBatch, Gotta Love It!

td

You could always use the Shell Operations Extender's aFileCopy function.  But if you boat is floating, why change course?
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

snowsnowsnow

That might be a waterfall up ahead...

td

"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

snowsnowsnow