Jump to content
Macro Express Forums

Moving folders and MEP hogging the source folder to be removed


Recommended Posts

Dear All,

I'm searching for some help on moving folders.

I'm re-organising the DVD's/Authored Projects on my server, and need to move their VIDEO_TS folders, and project files to another folder structure. The problem is for me to have a few thousand folders with project files and authored DVD's in them. If I do it manually, I'd be left with rsi and a lot of time wasted.

Using MEP I thought it to be pretty easy, and also found a good thread on moving folders.

http://pgmacros.invisionzone.com/topic/3655-move-files-folder/?hl=%2Bmove+%2Bfolder

I'm running into problems though trying the 1st part of moving a VIDEO_TS folder, I'm getting errors that the folder to be moved is used by another program, and as such can't be deleted from its original location. Thus an empty folder is left in the original location.

Digging deeper I found that it's MEP itself which is hogging the folder to be deleted from its original location, which probably explains the problem I'm having right away.

I'm using repeat folder to search through the project folder and it's subfolders to find the VIDEO_TS folder. Then a check is done for 3 files essential to a DVD structure, which if there will then move that specific folder to a different location. See example code I use developing the macro.

 

I think the repeat folder command is the one causing the original folder to be hogged by MEP.

 

If the folder is hogged by MEP, I can't even manually delete the original folder, even if the macro was stopped/ended. In such case I must exit MEP before I get control back over the original folder.

 

Don't mind the folder names, as that's just a test setup as I of course do not want to use the macro on the original files and structure before knowing it to work properly.

 

Added note, if I create code to directly move the folder, meaning hard paths, all works properly. See the 1st 2 lines of code in the example code below.

<COMMENT/>
<MOVE FILE/FILES Source="d:\\temp\\copy of temp4\\folder\\anotherfolder\\video_ts\\" Dest="d:\\temp\\copy of temp4\\VIDEO_TS" Progress="FALSE" Recurse="TRUE" _ENABLED="FALSE"/>
<MACRO STOP _ENABLED="FALSE"/>
<COMMENT Value="============================================="/>
<COMMENT Value="Check subfolders in root folder for files and DVD structure, move all to root accordingly"/>
<COMMENT Value="In case of DVD structure, move VIDEO_TS folder to root"/>
<COMMENT Value="============================================="/>
<COMMENT/>
<COMMENT Value="Set default variables"/>
<COMMENT Value="============================================="/>
<COMMENT Value="Variable holding CRLF"/>
<VARIABLE SET TO ASCII CHAR Value="13" Destination="%CRLF%"/>
<VARIABLE SET TO ASCII CHAR Value="10" Destination="%T[1]%"/>
<VARIABLE MODIFY STRING Option="\x07" Destination="%CRLF%" Variable="%T[1]%" NoEmbeddedVars="FALSE"/>
<COMMENT Value="Prompt for folder containing subfolders to sort out"/>
<VARIABLE SET STRING Option="\x09" Destination="%FolderRoot%" Value="Select folder containing the subfolders to be sorted" _ENABLED="FALSE"/>
<VARIABLE SET STRING Option="\x00" Destination="%FolderRoot%" Value="d:\\temp\\Copy of Temp4" NoEmbeddedVars="FALSE"/>
<COMMENT Value="Run through the subfolders in the provided root folder"/>
<REPEAT WITH FOLDER Path="%FolderRoot%" OnlyFiles="FALSE" Destination="%FolderSub%" FullPath="TRUE" ProcSubfolders="TRUE"/>
<COMMENT Value="Check if current folder is a DVD VIDEO_TS folder"/>
<IF VARIABLE Variable="%FolderSub%" Condition="\x06" Value="\\VIDEO_TS" IgnoreCase="TRUE"/>
<COMMENT Value="Check if this VIDEO_TS folder contains files related to a DVD structure"/>
<COMMENT Value="Check 3 files which should be there, VIDEO_TS.IFO, VIDEO_TS.VOB, and VTS_01_0.VOB"/>
<IF FILE EXISTS File="%FolderSub%\\VIDEO_TS.IFO" Search_Path="FALSE"/>
<AND/>
<IF FILE EXISTS File="%FolderSub%\\VIDEO_TS.VOB" Search_Path="FALSE"/>
<AND/>
<IF FILE EXISTS File="%FolderSub%\\VTS_01_0.VOB" Search_Path="FALSE"/>
<COMMENT Value="Move the VIDEO_TS folder to the root folder"/>
<COMMENT Value="Source: http://pgmacros.invisionzone.com/topic/3655-move-files-folder/?hl=%2Bmove+%2Bfolder"/>
<COMMENT Value="MoreSpecific: http://pgmacros.invisionzone.com/topic/3655-move-files-folder/#entry14086"/>
<COMMENT Value="MoreSpecific: http://pgmacros.invisionzone.com/topic/3655-move-files-folder/#entry14099"/>
<REPEAT EXIT _ENABLED="FALSE"/>
<MOVE FILE/FILES Source="%FolderSub%\\" Dest="%FolderRoot%\\VIDEO_TS" Progress="FALSE" Recurse="TRUE"/>
<MESSAGEBOX Caption="lkhhj" Message="%FolderRoot%%CRLF%%FolderSub%" Icon="0" _ENABLED="FALSE"/>
<END IF/>
<END IF/>
<END REPEAT/>

The question then:
-Do any of you have any tips on releasing the folder from being hogged by MEP, such that it can be removed from its original location?

Thanks for any hints ant tips into finding a solution for this.

Best regards,

Link to comment
Share on other sites

I've done a lot of things like this and have never had a problem with MEP Repeat with Folder locking the folder. But if it is I'd work around the problem by trying to make a list in a string array of all though folders to be moved then a second loop to execute the actual moves.

 

BTW, how do you know MEP is locking the folders? You might also check your anti-virus. Sometimes having an application 'touch' files will cause the on access scanner to scan the file contents for viruses and in rare cases cause a lock.

Link to comment
Share on other sites

@rberq

 

That might work, I've done similar with renaming large numbers of files because MEP was so slow with that. Thanks for the idea, I'll have a good look at that.

 

@Cory

 

I know MEP is locking the folder because only after exiting (Terminating Macro Express Editor & Player) MEP will I have full control over it again. I disabled the check for the 3 file types to try see if those commands were locking the folder, which they didn't. The only other think left was the repeat with folder command. And since using hard paths would not be a problem, see 1st 2 code lines, my conclusion was for the repeat folder to be the cause.

 

For the same reason putting the folder/file structure in a string would not work I think, because once the 1st loop has looked through the folder/file structure, the folder will be hogged by MEP. I'm gonna have a look at it anyway though, just in case.

 

However, I'm very much baffled by it, because the only thing done there is looking into folders, nothing else. Virus scanner can't be it because that machine is off the network and has no virus scanner. It was slowing down the DVD authoring/recoding process way to much.

Link to comment
Share on other sites

I've been trying different things to sort out the problem I'm having, and it seems that repeat folder is indeed hogging the folder to be moved.

 

-I'm just wondering, when others try this on their computer, will they see the same problem, or is it just my hardware/software combination causing this?

-Just as information, my MEP version is 4.6.0.1.

 

This macro code works:

<COMMENT Value="============================================="/>
<COMMENT Value="d:\temp\copy of temp4\folder\anotherfolder\video_ts"/>
<COMMENT Value="THIS WORKS"/>
<COMMENT Value="Prompt for folder containing subfolders to sort out"/>
<VARIABLE SET STRING Option="\x00" Destination="%FolderRoot%" Value="d:\\temp\\Copy of Temp4" NoEmbeddedVars="FALSE"/>
<COMMENT Value="============================================="/>
<COMMENT Value="Run through the subfolders in the provided root folder"/>
<REPEAT WITH FOLDER Path="%FolderRoot%" OnlyFiles="FALSE" Destination="%FolderSub%" FullPath="TRUE" ProcSubfolders="TRUE"/>
<COMMENT Value="Check if current folder is a DVD VIDEO_TS folder"/>
<IF VARIABLE Variable="%FolderSub%" Condition="\x06" Value="\\anotherfolder" IgnoreCase="TRUE"/>
<VARIABLE SET STRING Option="\x00" Destination="%FolderSub%" Value="d:\\temp\\copy of temp4\\folder\\anotherfolder\\VIDEO_TS" NoEmbeddedVars="FALSE"/>
<MOVE FILE/FILES Source="%FolderSub%\\" Dest="%FolderRoot%\\VIDEO_TS" Progress="FALSE" Recurse="TRUE"/>
<REPEAT EXIT/>
<END IF/>
<END REPEAT/>
<COMMENT Value="============================================="/>

And this macro code doesn't:

<COMMENT Value="============================================="/>
<COMMENT Value="d:\temp\copy of temp4\folder\anotherfolder\video_ts"/>
<COMMENT Value="THIS DOESN'T WORK"/>
<COMMENT Value="Prompt for folder containing subfolders to sort out"/>
<VARIABLE SET STRING Option="\x00" Destination="%FolderRoot%" Value="d:\\temp\\Copy of Temp4" NoEmbeddedVars="FALSE"/>
<COMMENT Value="============================================="/>
<COMMENT Value="Run through the subfolders in the provided root folder"/>
<REPEAT WITH FOLDER Path="%FolderRoot%" OnlyFiles="FALSE" Destination="%FolderSub%" FullPath="TRUE" ProcSubfolders="TRUE"/>
<COMMENT Value="Check if current folder is a DVD VIDEO_TS folder"/>
<IF VARIABLE Variable="%FolderSub%" Condition="\x06" Value="\\video_ts" IgnoreCase="TRUE"/>
<VARIABLE SET STRING Option="\x00" Destination="%FolderSub%" Value="d:\\temp\\copy of temp4\\folder\\anotherfolder\\VIDEO_TS" NoEmbeddedVars="FALSE"/>
<MOVE FILE/FILES Source="%FolderSub%\\" Dest="%FolderRoot%\\VIDEO_TS" Progress="FALSE" Recurse="TRUE"/>
<REPEAT EXIT/>
<END IF/>
<END REPEAT/>
<COMMENT Value="============================================="/>

The only difference is the current folder in the repeat folder cycle.

 

From it I think I can clearly conclude that repeat folder is the culprit.

 

I've now changed my code to check if the VIDEO_TS folder exists in current repeat folder cycle, and that solved my problem. Just as simple, just a different approach.

 

-However, I'm just wondering if others would have the same problem if they tried above code?

 

Best regards,

Link to comment
Share on other sites

  • 2 weeks later...

I'd have to modify your code to test and I don't have the time at the moment. But if you created a very simple macro that illustrates using a common folder like the desktop I'd be happy to test it for you. Also it might be nice if you attached it as a macro file or an MXE.

 

Also if you are trying to move a folder that is the object of the MEP repeat command it would make sense that it's locked. MEP is using it! So I'm assuming that you're talking about subfolders.

Link to comment
Share on other sites

Just in case anyone runs into similar issues in future.

 

This thing has been bugging me for some time now, returning depending upon what I wanted, but never solved completely. There was no way I could find to solve it using MEP itself, thus I've resorted to what is so far a full proof solution. It needs an external tool though unfortunately.

 

The only time I see this is when using the Repeat with Folder Folders Only command, to date I've not had similar problems using Repeat with Folder Files Only.

 

It's definetely MEP causing the problems, see screenshot taken "MEP_RepeatFolderHoggingFolders.JPG". (Sorry, don't know how to insert the image)

 

Anyhow, fortunately the tool I made the screenshot of is a free tool, with command line options. Once installed its program folder can be simply copied from PC to PC, and it will work properly. Thus portable. The only disadvange is that the right click menu "Unlocker" option doesn't show, but for the moment I don't care.

 

Using it just before I move the folder unlocks the by MEP hogged folder and moves it as I want. The tool itself is called "Unlocker 1.9.2", and freely downloadable from the internet.

 

I've checked for ill side effects, and unwanted problems using MEP further after using unlocker, but to date none were experienced.

 

Hope it's usefull for someone else.

 

Best regards,

post-4537-0-86441000-1413196924_thumb.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...