[Windows Mobile Software Development] howdykeith:
DC_DIRS

Quote:

Originally Posted by Jokes On You

The only trouble I see with this is that DC_DIRS may not return alphabetically.

Code:

Directory = DirContents("Storage Card\My Documents\Case Files\*", DC_DIRS)

Move( Directory[1], "My Documents\Current\" , TRUE, TRUE)

Delete(Directory[1])If that doesnt work there is a trick to returning the first alphanumerical folder.

Code:

Directory = DirContents("Storage Card\My Documents\Case Files\*", DC_DIRS)

Foreach item,folder in array(Directory)

Dir[folder] = item

If(item = 1)

Move( item, "My Documents\Current\" , TRUE, TRUE)

Delete(item)

Break(BLOCK_FOR)

EndIf

EndForEachEDIT: I tried the first one and it seems to work. The issue I have found is that there is a bug where DC_DIRS returns files and not just directories so if you have a file that is alphanumerically before the first subdirectory it will be moved and deleted rather than the first directory.

I remember that bug about DC_DIRS... not sure, but I THINK it's only in the latest betas on the PC? It seems DC_FILES, DC_DIRS, and DC_ALL were not defined. The solution was to define them yourself if they are not defined in the version of MortScript you are using. They should be set to:

Code:

DC_ALL=0

DC_FILES=1

DC_DIRS=2Also, DirContents doesn't return the full path, only the file/folder in the path, so you need to tag on the path to it. There should also be a leading "\" in the path. So...

Code:

DC_DIRS=2

Source="\Storage Card\My Documents\Case Files"

Dest="\My Documents\Current"

Directory = DirContents(Source\"*", DC_DIRS)

Move(Source\Directory[1], Dest , TRUE, TRUE)

Delete(Source\Directory[1])Also, for deleting the original folder, I think you would have to use DelTree, not Delete. So, I'm thinking this might be better?:

Code:

DC_DIRS=2

Source="\Storage Card\My Documents\Case Files"

Dest="\My Documents\Current"

Directory = DirContents(Source\"*", DC_DIRS)

Move(Source\Directory[1], Dest , TRUE, TRUE)

DelTree(Source\Directory[1])Even better would be to somehow make sure the Move worked before deleting the original... don't like the idea of possibly losing data! Failing that, possibly change the Move to a Copy... would have to check, but MortScript might let you abort if the copy failed?:

Code:

DC_DIRS=2

Source="\Storage Card\My Documents\Case Files"

Dest="\My Documents\Current"

Directory = DirContents(Source\"*", DC_DIRS)

Copy(Source\Directory[1], Dest , TRUE, TRUE)

DelTree(Source\Directory[1])Personally, I don't think I'd delete them at all in the script, I would rename them to the end of the list, and then manually delete later... so, try this?:

Code:

DC_DIRS=2

Source="\Storage Card\My Documents\Case Files"

Dest="\My Documents\Current"

Directory = DirContents(Source\"*", DC_DIRS)

Copy(Source\Directory[1], Dest , TRUE, TRUE)

Rename(Source\Directory[1], Source\"zzz_"&Directory[1])This is all untested code, btw, just done during the post (except for the defining of the DC_* variables).

Oh, BTW, that second block of code of yours will only work on the betas... v4.2 didn't have a BREAK statement. But it's a non-issue, since DirContents does return the files/directories sorted.

Posted here:

http://xdaforums.com/showpost.php?p=6100506&postcount=3189