Jump to content

Recommended Posts

Posted (edited)

Good day,

I have been experiencing some rather "glitchy" results with DirMove...and I would really, really appreciate some assistance here! "Pretty please...with sugar on top!"...was the vernacular of the day!!

See: Sub-Folder Contents.txt for information on this project.
• I have also provided a copy of all of the required data.

What I AM discovering, is that the remarks provided for this keyword|command is not very explicit! For example:

Spoiler

Remarks
1a) If the source and destination locations are on different drives, then a copy/delete operation will be performed, rather than a move.
• This operation would be considered as a standard Windows practice - being identical then to a "Cut" operation.
• Correct? Incorrect?
1a) If the above is true, and the source and destination locations are not on different drives - which in this case, is true, then a move operation would then be performed.
• Correct? Incorrect?
2a) If the destination already exists and the overwrite flag is specified, then the source directory will be moved inside the destination.
2b) If the destination already exists and the overwrite flag is not specified, the source directory would then NOT be moved inside the destination.
• Correct? Incorrect?

Notes
I get absolutely no result with no optional flag employed! Why is this the case?

PS: I am really trying to keep this entire process SIMPLE!!
• I will employ error checking at a later point.
• What I am asking for is a simple example of how you would approach this project.
• So, no arrays or any such thing...see the following:

#include <FileConstants.au3>
DirMove("C:\Path1\VST_PlugIns\Compressor", "C:\Path_Copy\VST_PlugIns")
DirMove("C:\Path1\VST_PlugIns\EQ", "C:\Path_Copy\VST_PlugIns")
DirMove("C:\Path1\VST_PlugIns\Reverb", "C:\Path_Copy\VST_PlugIns")

FileMove("C:\Path1\VST_PlugIns\Compressor.ini", "C:\Path_Copy\VST_PlugIns")
FileMove("C:\Path1\VST_PlugIns\EQ.ini", "C:\Path_Copy\VST_PlugIns")
FileMove("C:\Path1\VST_PlugIns\Reverb.ini", "C:\Path_Copy\VST_PlugIns")

Any assistance in this matter would be greatly appreciated!

Sub-Folder Contents.txt Assets.7z

Edited by mr-es335
Posted (edited)

try with

#include <FileConstants.au3>

FileMove("C:\Path1\VST_PlugIns\Compressor.ini", "C:\Path_Copy\VST_PlugIns", $FC_CREATEPATH)
FileMove("C:\Path1\VST_PlugIns\EQ.ini", "C:\Path_Copy\VST_PlugIns", $FC_CREATEPATH)
FileMove("C:\Path1\VST_PlugIns\Reverb.ini", "C:\Path_Copy\VST_PlugIns", $FC_CREATEPATH)

DirMove("C:\Path1\VST_PlugIns\Compressor", "C:\Path_Copy\VST_PlugIns")
DirMove("C:\Path1\VST_PlugIns\EQ", "C:\Path_Copy\VST_PlugIns")
DirMove("C:\Path1\VST_PlugIns\Reverb", "C:\Path_Copy\VST_PlugIns")

and if you have a problem, check the attributes of .dll files, maybe it's better to copy and delete?

Edited by ioa747

I know that I know nothing

Posted (edited)

ioa747,

Great point! Saves a step-or-two! Thanks for this!

But, I am thinking that I really should have left out the FileMove, as it is DirMove that I attempting to get my head around.

PS: I wonder why a $FC_CREATEPATH flag was not provided with DirMove?

Here is what I have gleaned thus far:

Spoiler

#include <FileConstants.au3>
; Employing: $FC_OVERWRITE

; Part A1
; If the destination directory already exists and the overwrite flag is specified,
; then the source directory will be moved inside the destination directory.
; The source directory: "C:\Path1\VST_PlugIns"
; The destination directory: "C:\Path_Copy"
; Thus, VST_PlugIns should be moved to Path_Copy
;DirMove("C:\Path1\VST_PlugIns", "C:\Path_Copy", $FC_OVERWRITE) ; To test, remove comment!
; Result should be: "C:\Path_Copy\VST_PlugIns"
; Status: TRUE!!
; Take-aways
; The source directory is the full path where the source data is currenty located,
; such as: "C:\Path1\VST_PlugIns"
; Whatever is contained within the source directory will be moved during execution
; The destination directory is the full path - which is the entire path, where the
; source data will be moved, such as: "C:\Path1\VST_PlugIns"
; Whatever is contained within the new destination directory will be that folder|data
; that was previously moved during execution, such as: "C:\Path_Copy\VST_PlugIns"

; Part A2
; If the destination directory does not already exist and the overwrite flag is specified,
; then the destination directory will 1) be created, followed by, 2) the contents only of
; the source directory [VST_PlugIns] being moved to the newly created destination directory
; [C:\Path_Copy].
;DirMove("C:\Path1\VST_PlugIns", "C:\Path_Copy", $FC_OVERWRITE) ; To test, remove comment!
; Take-aways
; If the source directory is to be replicated, then the destination directory "must be
; specified".
; If not, then, as noted above, the destination directory will be created, with the
; contents the source directory, that is, VST_PlugIns, being moved to the newly created
; destination directory.
; Thus, VST_PlugIns now becomes C:\Path_Copy.

; ===========================================================

#include <FileConstants.au3>
; Employing: $FC_NOOVERWRITE

; Part B1
; If the destination directory already exists and the overwrite flag is not specified,
; then nothing occurs!
;DirMove("C:\Path1\VST_PlugIns", "C:\Path_Copy", $FC_NOOVERWRITE) ; To test, remove comment!
; Take-aways: None

; Part B2
; If the destination directory does not already exist and the overwrite flag is not specified,
; then the destination directory will 1) be created, followed by, 2) the contents only of
; the source directory [VST_PlugIns] being moved to the newly created destination directory
; [C:\Path_Copy].
; Thus, identical to A2!
;DirMove("C:\Path1\VST_PlugIns", "C:\Path_Copy", $FC_NOOVERWRITE) ; To test, remove comment!
; Take-aways
; If no destination directory exists then, as noted above, the destination directory will
; be created, with the contents the source directory, that is, VST_PlugIns, being moved
; to the newly created destination directory.
; Again, VST_PlugIns now becomes C:\Path_Copy.

; Part B3
; If the destination directory does not already exist and the overwrite flag is not specified,
; and VST_PlugIns is added to the destination directory  then the destination directory will
; 1) be created, followed by, 2) the contents only of the source directory [VST_PlugIns] being
; moved to the newly created destination directory [C:\Path_Copy].
;DirMove("C:\Path1\VST_PlugIns", "C:\Path_Copy\VST_PlugIns", $FC_NOOVERWRITE) ; To test, remove comment!
; Take-aways
; If no destination directory exists then, and the sub-folder is included then, as noted above,
; the destination directory will be created, with the contents the source directory, that is,
; VST_PlugIns, being moved to the newly created destination directory.
; Again, identical to A2!

; Final Note
; In any event, it might be preferable - and simpler, to always include the $FC_OVERWRITE flag.

 

Edited by mr-es335
Update notes
Posted

it could be

#include <FileConstants.au3>
If Not FileExists("C:\Path_Copy\VST_PlugIns") Then DirCreate("C:\Path_Copy\VST_PlugIns")
DirMove("C:\Path1\VST_PlugIns\Compressor", "C:\Path_Copy\VST_PlugIns")
DirMove("C:\Path1\VST_PlugIns\EQ", "C:\Path_Copy\VST_PlugIns")
DirMove("C:\Path1\VST_PlugIns\Reverb", "C:\Path_Copy\VST_PlugIns")

FileMove("C:\Path1\VST_PlugIns\Compressor.ini", "C:\Path_Copy\VST_PlugIns")
FileMove("C:\Path1\VST_PlugIns\EQ.ini", "C:\Path_Copy\VST_PlugIns")
FileMove("C:\Path1\VST_PlugIns\Reverb.ini", "C:\Path_Copy\VST_PlugIns")

 

I know that I know nothing

Posted (edited)

ioa747,

Great idea! Why did I not think of this?? Duh!! "Sweet and concise!"...at least to me!

For whatever reason,l I have what I refer to as "the order of precedence"....with this precedence being" files-then-folders. Thus, your earlier example would be more apropos.

Thanks again!!

PS: Did you have a peep at my notes? I would appreciate your comments.

Edited by mr-es335
Posted (edited)

ioa747,

I just tested both examples and neither are working? Was this to be expected?

The first example 1) moves the .ini files, 2) creates a VST_PlugIns file, and 3) does not copy the folders.

The second example 1) creates the VST_PlugIns destination folder, 2) moves the .ini files to this folder, and 3) does not copy the folders.

This does work:

#include <FileConstants.au3>

FileMove("C:\Path1\VST_PlugIns\Compressor.ini", "C:\Path_Copy\VST_PlugIns", $FC_OVERWRITE + $FC_CREATEPATH)
FileMove("C:\Path1\VST_PlugIns\EQ.ini", "C:\Path_Copy\VST_PlugIns", $FC_OVERWRITE + $FC_CREATEPATH)
FileMove("C:\Path1\VST_PlugIns\Reverb.ini", "C:\Path_Copy\VST_PlugIns", $FC_OVERWRITE + $FC_CREATEPATH)

DirMove("C:\Path1\VST_PlugIns\Compressor", "C:\Path_Copy\VST_PlugIns", $FC_OVERWRITE)
DirMove("C:\Path1\VST_PlugIns\EQ", "C:\Path_Copy\VST_PlugIns", $FC_OVERWRITE)
DirMove("C:\Path1\VST_PlugIns\Reverb", "C:\Path_Copy\VST_PlugIns", $FC_OVERWRITE)

...as does this...

#include <FileConstants.au3>
If Not FileExists("C:\Path_Copy\VST_PlugIns") Then DirCreate("C:\Path_Copy\VST_PlugIns")

DirMove("C:\Path1\VST_PlugIns\Compressor", "C:\Path_Copy\VST_PlugIns", $FC_OVERWRITE)
DirMove("C:\Path1\VST_PlugIns\EQ", "C:\Path_Copy\VST_PlugIns", $FC_OVERWRITE)
DirMove("C:\Path1\VST_PlugIns\Reverb", "C:\Path_Copy\VST_PlugIns", $FC_OVERWRITE)

FileMove("C:\Path1\VST_PlugIns\Compressor.ini", "C:\Path_Copy\VST_PlugIns", $FC_OVERWRITE)
FileMove("C:\Path1\VST_PlugIns\EQ.ini", "C:\Path_Copy\VST_PlugIns", $FC_OVERWRITE)
FileMove("C:\Path1\VST_PlugIns\Reverb.ini", "C:\Path_Copy\VST_PlugIns", $FC_OVERWRITE)

 

Edited by mr-es335
Posted (edited)

... and if you have a problem, check the attributes of .dll files and folders, maybe it's better to copy and delete?

else you should remove the 'READONLY' with the FileSetAttrib()

Edited by ioa747

I know that I know nothing

Posted (edited)

I always check the file attributes and all are OK!

The following might be interest however...

Spoiler

Can't unset 'Read-only (Only applies to files in folder)' in windows 7

You really can't unset Read-only attribute on any folder in Explorer: Explorer always shows Read-only attribute in indeterminate state (starting from Windows 7, if I remember correctly). Yet attrib will tell you whether Read-only attribute is set or not.

Read-only attribute on a folder does not affect whether a user can modify its contents or not. However, Read-only attribute is a special attribute for Explorer. If Read-only attribute is set, Explorer will search for desktop.ini inside the folder and loads it. For example, this way Documents, Pictures and other folder are localized in your user profile.

If the folder is writable using Explorer or Command Prompt, then you have access to write to that folder.
https://tinyurl.com/2etyx5xx

 

Edited by mr-es335

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
  • Recently Browsing   0 members

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