Everyone Posted November 11, 2009 Share Posted November 11, 2009 (edited) 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 November 11, 2009 by Everyone Link to comment Share on other sites More sharing options...
Authenticity Posted November 11, 2009 Share Posted November 11, 2009 Add this to the top of the script: Opt("ExpandEnvStrings", 1) ;0=don't expand, 1=do expand Link to comment Share on other sites More sharing options...
Everyone Posted November 11, 2009 Author Share Posted November 11, 2009 Thanks Link to comment Share on other sites More sharing options...
Everyone Posted November 11, 2009 Author Share Posted November 11, 2009 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 More sharing options...
Authenticity Posted November 11, 2009 Share Posted November 11, 2009 Read the function remarks. Maybe DirCopy is more appropriate with your case. Link to comment Share on other sites More sharing options...
Everyone Posted November 11, 2009 Author Share Posted November 11, 2009 (edited) 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/DocumentsMy Pictures = [...]/UserX/Documents/My PicturesMy Music = [...]/UserX/Documents/My MusicThey need to be moved to[...]/UserY/Docs[...]/UserY/Docs/Pics[...]/UserY/Docs/TunesIf 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 November 11, 2009 by Everyone Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now