Jump to content
Macro Express Forums

File Manipulation Advice Needed


Cory

Recommended Posts

I had my macro creating a directory, moving a file then renaming which was a lot of extra work and variables. I tried a simple move test and found that it would create teh path if it didn't exist and rename the file and attempted to do it all in one step which worked in my simple test. But now I'm getting strange results with the real thing. Especially somethng to do with the character count truncating names and such. Is there a writeup someplace on the limitations with move, rename and the ilk? Seems it works sometimes but not always.

Link to comment
Share on other sites

Try using the Wait for File Exist and then Wait for File Ready commands after the Rename File or Files command.

Rename File or Files: "original.txt"
Wait for File Exist: "copyof.txt"
Wait for File Ready: "copyof.txt"

Set the file Must be Ready for XXX Seconds field (in the Wait for file Ready command) for maybe 1 or 2 seconds if you are renaming large files. This tells Macro Express to continue waiting until Windows has not written anything to the file for the specified time period.

 

Keep in mind that renaming a file can be fast or slow depending on where it is being moved and renamed to. If all action is to take place within the same partition on your drive then Windows does not actually do anything other than changing the internal index of where the file is. On the other hand, if the action spans a second drive, partition, or network, then Windows must physically move the file, which will take longer. Hence the need for the Wait for File Ready command.

Link to comment
Share on other sites

Ah, I see. I realized that possibly WAIT FOR READY might be failing because it didn't exist yet but I didn't think or pairing the two up. Good advice.

 

But my question has more to do with the different operations and their limitations. I think one can reanme a file and in effect also move it to another folder and even have it create to folder structure but it appears that it only works if it's on the same volume. Take the same command and change columes and strange things happen. Also sometimes it appears you can use the move command and rename it but it gives odd results sometimes. I was hopng for some clue as to when I could just use rename or move and when I had to do Rename, create directory, move.

Link to comment
Share on other sites

... but I didn't think or pairing the two up. Good advice.
Maybe it is good advice. Others might do it differently. Some may think that both commands are not needed. I know, however, that this always works for me.
I think one can reanme a file and in effect also move it to another folder and even have it create to folder structure
Yes, you can.
but it appears that it only works if it's on the same volume.
Not true. It works just fine across volumes and networks.
I was hopng for some clue as to when I could just use rename or move and when I had to do Rename, create directory, move.
Both systems work. It is just a matter of choice.
Link to comment
Share on other sites

Your insistance that it does work made me look more closely at what I was doing and I now think I see a flaw. Tomorrow I'll try again. Thanks for th confidence boost.

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...