Jump to content

DirMove() fails with %systemvar%-type folders


Everyone
 Share

Recommended Posts

I'm making an app that will move files from user's profile into a new structure. To work properly, it needs to read the current folder structure from registry. The problem is that DirMove() doesn't understand stuff coded in system/environment variables like %USERPROFILE%, %USERNAME%, etc. and default shell folders' structure is written in registry keys using those variables. Is there an easy way to get around this, or should I fall back to xcopy?

Edited by Everyone
Link to comment
Share on other sites

I got another problem :) it seems that DirMove() doesn't continue moving files after encountering a file that it cannot move and just gives up for the rest of them. It doesn't even copy them. Any chance of resolving this problem without having to write a function of my own or searching for some UDFs which still would have to be tested and eventually implemented? I'm messing with that move-files-thing a long time now and I would already publish the app if it wasn't for this showstopper ;)

Link to comment
Share on other sites

Not really. The thing is that I'm trying to move data from user shell folders to folders chosen by the user. For example, here are some registry keys with their corresponding values:

Personal = [...]/UserX/Documents

My Pictures = [...]/UserX/Documents/My Pictures

My Music = [...]/UserX/Documents/My Music

They need to be moved to

[...]/UserY/Docs

[...]/UserY/Docs/Pics

[...]/UserY/Docs/Tunes

If just DirCopy Documents, My Pictures and My Music, their data will be put into right places BUT as a side effect, folder Docs, while having folder Pics and Tunes will now also have unwanted redundancies in form of My Pictures and My Music folders. If I put all paths in an array, sort the array descending, and then move folders one after another, this side effect won't happen and even if it will, it won't happen very often and redundant folders won't have much files inside them. Of course some system-locked files cannot be moved, but IMO the function should just skip'em.

Besides I think that DirCopy will fail in the same manner - as soon as it encounters a file that it cannot copy, it will just quit.

Edited by Everyone
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...